From 865dfc011cc2bb823b988aa652060ee889ad893f Mon Sep 17 00:00:00 2001 From: nobuQuartile Date: Thu, 5 Dec 2024 06:51:53 +0000 Subject: [PATCH] [FIX] mail_show_follower: Company identification in _send() Before this commit, 'Show Internal Users CC' would always be False, regardless of the setting in the company, in case the message came from a record with a company_id field but without a value assignment to it (e.g., a partner record with no company), as company would be an empty record. This commit fixes the behavior by capturing company from self.env in these cases. --- mail_show_follower/models/mail_mail.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mail_show_follower/models/mail_mail.py b/mail_show_follower/models/mail_mail.py index 845a7c4f31..9e06ab91b8 100644 --- a/mail_show_follower/models/mail_mail.py +++ b/mail_show_follower/models/mail_mail.py @@ -73,7 +73,9 @@ def _send(self, auto_commit=False, raise_exception=False, smtp_session=None): # recipients from any Notification Type (i.e. email, inbox, etc.) recipients = mail.notification_ids.res_partner_id record = self.env[mail.model].browse(mail.res_id) - company = getattr(record, "company_id", self.env.company) + company = getattr(record, "company_id", False) + if not company: + company = self.env.company show_internal_users = company and company.show_internal_users_cc show_in_cc_recipients = recipients._filter_shown_in_cc(show_internal_users) if len(show_in_cc_recipients) <= 1: