[15.0][ADD] mail_partner_company_resolve#944
Open
nobuQuartile wants to merge 1 commit intoOCA:15.0from
Open
Conversation
4150772 to
664ff17
Compare
yostashiro
suggested changes
Feb 17, 2026
| @@ -0,0 +1,10 @@ | |||
|
|
|||
| CC addresses as followers, but the company restriction is not considered. In a multi-company | ||
| environment, if a customer sends an email with a CC address that belongs to a contact | ||
| dedicated to another company, that contact is added as a follower. Since the user lacks | ||
| access rights to that contact’s company, they can no longer view the chatter. |
Member
There was a problem hiding this comment.
Suggested change
| access rights to that contact’s company, they can no longer view the chatter. | |
| access rights to that contact’s company, they get an access error viewing the record. |
Comment on lines
+2
to
+3
| (or no company) and ensures new partners created from emails are assigned to the | ||
| current company. |
Member
There was a problem hiding this comment.
and ensures new partners created from emails are assigned to the current company.
Do we need this functionality?
Comment on lines
+13
to
+15
| if not extra_domain: | ||
| extra_domain = [] | ||
| extra_domain.append(("company_id", "in", [self.env.company.id, False])) |
Member
There was a problem hiding this comment.
To be safe.
Suggested change
| if not extra_domain: | |
| extra_domain = [] | |
| extra_domain.append(("company_id", "in", [self.env.company.id, False])) | |
| extra_domain = expression.AND( | |
| [extra_domain or [], [("company_id", "in", [self.env.company.id, False])]] | |
| ) |
Comment on lines
+16
to
+27
| threads_with_default_company = self.with_context( | ||
| default_company_id=self.env.company.id | ||
| ) | ||
| partners = super( | ||
| MailThread, threads_with_default_company | ||
| )._mail_find_partner_from_emails( | ||
| emails, | ||
| records=records, | ||
| force_create=force_create, | ||
| extra_domain=extra_domain, | ||
| ) | ||
| return partners |
Member
There was a problem hiding this comment.
Assigning the default company can be handled with https://github.com/OCA/partner-contact/tree/15.0/partner_company_default IMO. Any reason we should force it here?
Suggested change
| threads_with_default_company = self.with_context( | |
| default_company_id=self.env.company.id | |
| ) | |
| partners = super( | |
| MailThread, threads_with_default_company | |
| )._mail_find_partner_from_emails( | |
| emails, | |
| records=records, | |
| force_create=force_create, | |
| extra_domain=extra_domain, | |
| ) | |
| return partners | |
| return super()._mail_find_partner_from_emails( | |
| emails, | |
| records=records, | |
| force_create=force_create, | |
| extra_domain=extra_domain, | |
| ) |
Member
|
Name suggestion: mail_partner_resolution_by_company (which is actually the name in the manifest file). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In models like project.task that interact directly with customers, incoming emails add CC addresses as followers, but the company restriction is not considered.
In a multi-company environment, if a customer sends an email with a CC address that belongs to a contact dedicated to another company, that contact is added as a follower.
Since the user lacks access rights to that contact’s company, they can no longer view the chatter.
This module addresses the issue by adding a company domain when matching email addresses to contacts.
If no contact visible to that company is found, a new contact is created and that company is set on the company field.
@qrtl
QT6388