-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
[18.0][MIG] mail_composer_cc_bcc: Migration to 18.0 #3
base: 18.0
Are you sure you want to change the base?
Conversation
def _prepare_email_message(self, message, smtp_session): | ||
""" | ||
Define smtp_to based on context instead of To+Cc+Bcc | ||
""" |
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.
If i choose to add no default user inside Bcc (from company). But then i add them manually within the composer, i got this error: Invalid email address. It is because of the native _prepare_email_message which checks if email address is inside 'email_to', 'email_cc', 'email_bcc'. However, Bcc addresses is empty (inside the headers instead). So smtp_to_list is empty too and the assert smtp_to_list, self.NO_VALID_RECIPIENT returns the error.
I tested with Odoo 17.4 which is not 18 but closely, and i was able to bypass the error by adding my Bcc addresses list inside the message before calling super().
# Find the value for 'X-Odoo-Bcc'
x_odoo_bcc_value = next((value for key, value in message._headers if key == 'X-Odoo-Bcc'), None)
# Add Bcc field inside message to pass validation
if x_odoo_bcc_value:
message['Bcc'] = x_odoo_bcc_value
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.
Hi @Jerem-b, indeed, thank you so much 🙏
I just updated the code to include your contribution
…ents when no cc or bcc
Currently translated at 83.3% (15 of 18 strings) Translation: social-16.0/social-16.0-mail_composer_cc_bcc Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_composer_cc_bcc/es/
Currently translated at 100.0% (18 of 18 strings) Translation: social-16.0/social-16.0-mail_composer_cc_bcc Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_composer_cc_bcc/es/
Currently translated at 100.0% (18 of 18 strings) Translation: social-16.0/social-16.0-mail_composer_cc_bcc Translate-URL: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_composer_cc_bcc/it/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: social-17.0/social-17.0-mail_composer_cc_bcc Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_composer_cc_bcc/
Currently translated at 100.0% (17 of 17 strings) Translation: social-17.0/social-17.0-mail_composer_cc_bcc Translate-URL: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_composer_cc_bcc/it/
…onstraint "unique_mail_message_id_res_partner_id_if_set" when adding the same user to CC field that is already set as a follower
### This changes 1. Refactor _generate_template_recipients 2. Fix invalid-email-address for Bcc - In standard, Bcc key in dict message was stripped in https://github.com/odoo/odoo/blob/4394940a09900aa5b42cbc05355880598608d1b6/odoo/addons/base/models/ir_mail_server.py#L676 - Duplicate the key to retain for later assertion
3b65220
to
905eb25
Compare
ignore, you did so already in v17 |
Changes in 18.0
This changes
[IMP] mail_composer_cc_bcc: refactor _generate_template_recipients
Invalid field 'partner_bcc_ids' on model 'mail.mail
in case of mass mailing