OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – Programming Questions Filter business unit not work

This topic contains 1 reply, has 2 voices, and was last updated by  Mike Kudelya 7 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #25229

    pjo
    Participant

    I use this config:
    businessUnitId:
    label: Agence
    type: choice-business-unit
    data_name: accountOwner.owner
    options:
    #lazy: “@oro_organization.provider.filter.busines_unit_choice_tree->shouldBeLazy”
    data: “@?oro_organization.provider.filter.busines_unit_choice_tree->getList”

    accountOwner = account.owner
    But when I lunch the filter with value id 3, I have this request:

    WHERE
    o4_.business_unit_owner_id IN (
    SELECT
    o7_.id
    FROM
    oro_user o7_
    LEFT JOIN oro_user_business_unit o9_ ON o7_.id = o9_.user_id
    LEFT JOIN oro_business_unit o8_ ON o8_.id = o9_.business_unit_id
    WHERE
    o8_.id IN (3)
    )

    Business_unit_id is a relation with oro_business_unit table why a “where in” with oro_user ? I want all account with a user belong to agence id 3.

    Account.owner.owner.id = 3

    Thank you

    I’m sorry for my english.

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #25230

    Mike Kudelya
    Participant

    Hi,

    Let me explain why it happens.

    Account’s ownership is an User. User’s ownership is a Business Unit.
    To filter Accounts by Business Unit you needed create join between User and Business Unit.

Viewing 1 replies (of 1 total)

The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.

Back to top