-
-
Notifications
You must be signed in to change notification settings - Fork 197
[17.0][FIX] partner_event: prioritize attendee partner by commercial partner #488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
76925ee to
e8e141d
Compare
| domain = [("email", "=ilike", email)] | ||
| partner_id = vals.get("partner_id") | ||
| if partner_id: | ||
| commercial_partner = Partner.browse(partner_id).commercial_partner_id | ||
| domain = [ | ||
| ("commercial_partner_id", "=", commercial_partner.id) | ||
| ] + domain | ||
| attendee_partner = Partner.search(domain, limit=1, order="id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the partner belongs to another entity, you won't reach it...
If you want to prioritize, you should at least search again with no commercial_partner restriction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And could you please add some tests to cover these cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
| domain = [("email", "=ilike", email)] | ||
| partner_id = vals.get("partner_id") | ||
| if partner_id: | ||
| commercial_partner = Partner.browse(partner_id).commercial_partner_id | ||
| domain = [ | ||
| ("commercial_partner_id", "=", commercial_partner.id) | ||
| ] + domain | ||
| attendee_partner = Partner.search(domain, limit=1, order="id") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And could you please add some tests to cover these cases?
When searching for attendee_partner_id by email, if the registration already has a partner_id assigned, first search within its commercial_partner_id group (parent + children). This avoids selecting an unrelated partner sharing the same email in other companies or contact groups. TT59509
e8e141d to
0e25692
Compare
chienandalu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙂👍
|
This PR has the |
|
/ocabot merge patch |
|
On my way to merge this fine PR! |
|
Congratulations, your PR was merged at a3da5b6. Thanks a lot for contributing to OCA. ❤️ |
When searching for attendee_partner_id by email, if the registration already has a partner_id assigned, first search within its commercial_partner_id group (parent + children). This avoids selecting an unrelated partner sharing the same email in other companies or contact groups.
@Tecnativa TT59509
@victoralmau @carlos-lopez-tecnativa please review