Skip to content

Conversation

@pilarvargas-tecnativa
Copy link
Contributor

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

@pilarvargas-tecnativa pilarvargas-tecnativa changed the title [17.0][FIX] event_registration_partner: prioritize attendee partner by commercial partner [17.0][FIX] partner_event: prioritize attendee partner by commercial partner Nov 28, 2025
Comment on lines 43 to 50
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")
Copy link
Member

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Comment on lines 43 to 50
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")

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
Copy link
Member

@chienandalu chienandalu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙂👍

@pedrobaeza pedrobaeza added this to the 17.0 milestone Dec 4, 2025
@OCA-git-bot
Copy link
Contributor

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

@pedrobaeza
Copy link
Member

/ocabot merge patch

@OCA-git-bot
Copy link
Contributor

On my way to merge this fine PR!
Prepared branch 17.0-ocabot-merge-pr-488-by-pedrobaeza-bump-patch, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 7e1ae0b into OCA:17.0 Dec 4, 2025
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at a3da5b6. Thanks a lot for contributing to OCA. ❤️

@pedrobaeza pedrobaeza deleted the 17.0-fix-partner_event branch December 4, 2025 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants