diff --git a/mail_composer_cc_bcc/README.rst b/mail_composer_cc_bcc/README.rst index 705373256..ed961e8a2 100644 --- a/mail_composer_cc_bcc/README.rst +++ b/mail_composer_cc_bcc/README.rst @@ -1,7 +1,3 @@ -.. image:: https://odoo-community.org/readme-banner-image - :target: https://odoo-community.org/get-involved?utm_source=readme - :alt: Odoo Community Association - ================ Email CC and BCC ================ @@ -11,13 +7,13 @@ Email CC and BCC !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:baa3864e6fc3754462520ec7eb76d0d09dbffbedbb627a99fe17c092ee3cf57f + !! source digest: sha256:5e7056e8253bca7efc5ac9245144740241c859cc47837e9c443639874eb86aa7 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Alpha-red.png :target: https://odoo-community.org/page/development-status :alt: Alpha -.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github @@ -119,13 +115,11 @@ Contributors - Son Ho - Tri Doan -- Alberto Nieto alberto.nieto@braintec.com (https://braintec.com) - Other credits ------------- -The creation and migration of this module from 16.0 to 17.0, and then -17.0 to 18.0 were financially supported by Camptocamp. +The creation and migration from 16.0 to 17.0 of this module were +financially supported by Camptocamp. Maintainers ----------- diff --git a/mail_composer_cc_bcc/__manifest__.py b/mail_composer_cc_bcc/__manifest__.py index e9f21635c..0ef5acba5 100644 --- a/mail_composer_cc_bcc/__manifest__.py +++ b/mail_composer_cc_bcc/__manifest__.py @@ -3,7 +3,7 @@ { "name": "Email CC and BCC", "summary": "This module enables sending mail to CC and BCC partners in mail composer form.", # noqa: E501 - "version": "18.0.1.0.2", + "version": "18.0.1.0.1", "development_status": "Alpha", "category": "Social", "website": "https://github.com/OCA/mail", diff --git a/mail_composer_cc_bcc/i18n/es.po b/mail_composer_cc_bcc/i18n/es.po index 5e48752c5..df3de827f 100644 --- a/mail_composer_cc_bcc/i18n/es.po +++ b/mail_composer_cc_bcc/i18n/es.po @@ -6,20 +6,21 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2026-05-07 18:19+0000\n" -"Last-Translator: Ed-Spain \n" +"PO-Revision-Date: 2023-11-08 13:02+0000\n" +"Last-Translator: Ivorra78 \n" "Language-Team: none\n" "Language: es\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 5.15.2\n" +"X-Generator: Weblate 4.17\n" #. module: mail_composer_cc_bcc #: model:ir.model.fields,field_description:mail_composer_cc_bcc.field_mail_compose_message__partner_bcc_ids #: model:ir.model.fields,field_description:mail_composer_cc_bcc.field_mail_mail__email_bcc #: model:ir.model.fields,field_description:mail_composer_cc_bcc.field_mail_template__email_bcc +#: model:ir.model.fields,field_description:mail_composer_cc_bcc.field_mail_template_preview__email_bcc msgid "Bcc" msgstr "Bcc" @@ -29,6 +30,11 @@ msgstr "Bcc" msgid "Bcc (Partners)" msgstr "Bcc (Socios)" +#. module: mail_composer_cc_bcc +#: model:ir.model.fields,help:mail_composer_cc_bcc.field_mail_template_preview__email_bcc +msgid "Blind Carbon copy recipients" +msgstr "" + #. module: mail_composer_cc_bcc #: model:ir.model.fields,help:mail_composer_cc_bcc.field_mail_mail__email_bcc msgid "Blind Cc message recipients" @@ -72,6 +78,11 @@ msgstr "Bcc por defecto" msgid "Default Cc" msgstr "Cc por defecto" +#. module: mail_composer_cc_bcc +#: model:ir.model,name:mail_composer_cc_bcc.model_mail_template_preview +msgid "Email Template Preview" +msgstr "" + #. module: mail_composer_cc_bcc #: model:ir.model,name:mail_composer_cc_bcc.model_mail_template msgid "Email Templates" @@ -90,7 +101,7 @@ msgstr "Asistente de redacción de correo electrónico" #. module: mail_composer_cc_bcc #: model:ir.model,name:mail_composer_cc_bcc.model_ir_mail_server msgid "Mail Server" -msgstr "Servidor de correo" +msgstr "" #. module: mail_composer_cc_bcc #: model:ir.model,name:mail_composer_cc_bcc.model_mail_message diff --git a/mail_composer_cc_bcc/i18n/it.po b/mail_composer_cc_bcc/i18n/it.po index 411cbebec..962ac3a0d 100644 --- a/mail_composer_cc_bcc/i18n/it.po +++ b/mail_composer_cc_bcc/i18n/it.po @@ -20,6 +20,7 @@ msgstr "" #: model:ir.model.fields,field_description:mail_composer_cc_bcc.field_mail_compose_message__partner_bcc_ids #: model:ir.model.fields,field_description:mail_composer_cc_bcc.field_mail_mail__email_bcc #: model:ir.model.fields,field_description:mail_composer_cc_bcc.field_mail_template__email_bcc +#: model:ir.model.fields,field_description:mail_composer_cc_bcc.field_mail_template_preview__email_bcc msgid "Bcc" msgstr "Ccn" @@ -29,6 +30,11 @@ msgstr "Ccn" msgid "Bcc (Partners)" msgstr "Ccn (partner)" +#. module: mail_composer_cc_bcc +#: model:ir.model.fields,help:mail_composer_cc_bcc.field_mail_template_preview__email_bcc +msgid "Blind Carbon copy recipients" +msgstr "Nascondi destinatari copia carbone" + #. module: mail_composer_cc_bcc #: model:ir.model.fields,help:mail_composer_cc_bcc.field_mail_mail__email_bcc msgid "Blind Cc message recipients" @@ -71,6 +77,11 @@ msgstr "Ccn predefinito" msgid "Default Cc" msgstr "Cc predefinito" +#. module: mail_composer_cc_bcc +#: model:ir.model,name:mail_composer_cc_bcc.model_mail_template_preview +msgid "Email Template Preview" +msgstr "Anteprima modello e-mail" + #. module: mail_composer_cc_bcc #: model:ir.model,name:mail_composer_cc_bcc.model_mail_template msgid "Email Templates" diff --git a/mail_composer_cc_bcc/i18n/mail_composer_cc_bcc.pot b/mail_composer_cc_bcc/i18n/mail_composer_cc_bcc.pot index 68dc18ab4..357407dde 100644 --- a/mail_composer_cc_bcc/i18n/mail_composer_cc_bcc.pot +++ b/mail_composer_cc_bcc/i18n/mail_composer_cc_bcc.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 18.0\n" +"Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/mail_composer_cc_bcc/models/mail_mail.py b/mail_composer_cc_bcc/models/mail_mail.py index 8ceb59e36..89546de3e 100644 --- a/mail_composer_cc_bcc/models/mail_mail.py +++ b/mail_composer_cc_bcc/models/mail_mail.py @@ -8,15 +8,16 @@ def format_emails(partners): - return [tools.formataddr((p.name or "", p.email)) for p in partners if p.email] + emails = [ + tools.formataddr((p.name or "", tools.email_normalize(p.email))) + for p in partners + if p.email + ] + return ", ".join(emails) def format_emails_raw(partners): - return [p.email for p in partners if p.email] - - -def format_emails_str(partners): - emails = format_emails(partners) + emails = [p.email for p in partners if p.email] return ", ".join(emails) @@ -45,7 +46,7 @@ def _prepare_outgoing_list( partner_to = self.env["res.partner"].browse(partner_to_ids) email_to = format_emails(partner_to) email_to_raw = format_emails_raw(partner_to) - email_cc = format_emails_str(self.recipient_cc_ids) + email_cc = format_emails(self.recipient_cc_ids) email_bcc = [r.email for r in self.recipient_bcc_ids if r.email] # Collect recipients (RCPT TO) and update all emails @@ -54,20 +55,22 @@ def _prepare_outgoing_list( for m in res: rcpt_to = None if m["email_to"]: - rcpt_to = extract_rfc2822_addresses(m["email_to"][0])[0] + addresses = extract_rfc2822_addresses(m["email_to"][0]) + rcpt_to = addresses[0] if addresses else None # If the recipient is a Bcc, we had an explicit header X-Odoo-Bcc # - It won't be shown by the email client, but can be useful for a recipient # noqa: E501 # to understand why he received a given email # - Also note that in python3, the smtp.send_message method does not # transmit the Bcc field of a Message object - if rcpt_to in email_bcc: + if rcpt_to and rcpt_to in email_bcc: m["headers"].update({"X-Odoo-Bcc": m["email_to"][0]}) # in the absence of self.email_to, Odoo creates one special mail for CC # see https://github.com/odoo/odoo/commit/46bad8f0 elif m["email_cc"]: - rcpt_to = extract_rfc2822_addresses(m["email_cc"][0])[0] + addresses = extract_rfc2822_addresses(m["email_cc"][0]) + rcpt_to = addresses[0] if addresses else None if rcpt_to: recipients.add(rcpt_to) diff --git a/mail_composer_cc_bcc/models/mail_thread.py b/mail_composer_cc_bcc/models/mail_thread.py index 73d8ad70f..3ca92a424 100644 --- a/mail_composer_cc_bcc/models/mail_thread.py +++ b/mail_composer_cc_bcc/models/mail_thread.py @@ -3,7 +3,7 @@ from odoo import models -from .mail_mail import format_emails_str +from .mail_mail import format_emails class MailThread(models.AbstractModel): @@ -40,11 +40,11 @@ def _notify_by_email_get_base_mail_values(self, message, additional_values=None) partners_cc = context.get("partner_cc_ids", None) if partners_cc: - res["email_cc"] = format_emails_str(partners_cc) + res["email_cc"] = format_emails(partners_cc) partners_bcc = context.get("partner_bcc_ids", None) if partners_bcc: - res["email_bcc"] = format_emails_str(partners_bcc) + res["email_bcc"] = format_emails(partners_bcc) return res @@ -86,14 +86,16 @@ def _notify_get_recipients(self, message, msg_vals, **kwargs): ): # notif is False, has no user, is therefore customer notif = "email" msg_type = "customer" + partner = ResPartner.browse(data.get("id")) + user = partner.user_ids[:1] # Link partner → user pdata = { "id": data.get("id"), + "uid": user.id if user else False, "active": data.get("active"), "share": data.get("share"), "notif": data.get("notif") and data.get("notif") or notif, "type": msg_type, "is_follower": data.get("is_follower"), - "uid": False, } rdata.append(pdata) return rdata diff --git a/mail_composer_cc_bcc/readme/CONTRIBUTORS.md b/mail_composer_cc_bcc/readme/CONTRIBUTORS.md index faba9a8ea..a8be9c134 100644 --- a/mail_composer_cc_bcc/readme/CONTRIBUTORS.md +++ b/mail_composer_cc_bcc/readme/CONTRIBUTORS.md @@ -2,6 +2,4 @@ > - Hai N. Le \<\> > - Son Ho \<\> - > - Tri Doan \<\> - -* Alberto Nieto (https://braintec.com) + > - Tri Doan \<\> \ No newline at end of file diff --git a/mail_composer_cc_bcc/readme/CREDITS.md b/mail_composer_cc_bcc/readme/CREDITS.md index 53026c980..2dae1962e 100644 --- a/mail_composer_cc_bcc/readme/CREDITS.md +++ b/mail_composer_cc_bcc/readme/CREDITS.md @@ -1 +1,2 @@ -The creation and migration of this module from 16.0 to 17.0, and then 17.0 to 18.0 were financially supported by Camptocamp. +The creation and migration from 16.0 to 17.0 of this module were +financially supported by Camptocamp. diff --git a/mail_composer_cc_bcc/static/description/index.html b/mail_composer_cc_bcc/static/description/index.html index ec9530fad..00ff57aba 100644 --- a/mail_composer_cc_bcc/static/description/index.html +++ b/mail_composer_cc_bcc/static/description/index.html @@ -3,7 +3,7 @@ -README.rst +Email CC and BCC -
+
+

Email CC and BCC

- - -Odoo Community Association - -
-

Email CC and BCC

-

Alpha License: AGPL-3 OCA/mail Translate me on Weblate Try me on Runboat

+

Alpha License: AGPL-3 OCA/mail Translate me on Weblate Try me on Runboat

Odoo native does not support defining a Cc field in the Mail Composer by default; instead, it only has a unique Recipients fields, which is confusing for a lot of end users.

@@ -383,7 +378,7 @@

Email CC and BCC

From Odoo 17.0, this module sends one mail per recipient and keeps same all headers (To, Cc, Bcc) in all emails

-

Features

+

Features

  • Add Cc and Bcc fields to company form to use them as default in mail composer form.
  • @@ -407,7 +402,7 @@

    Features

-

Configuration

+

Configuration

In company form there are two fields to set default cc and bcc partners.

res_company_form_default_cc_bcc
@@ -416,7 +411,7 @@

Configuration

email_template_form_cc_bcc
-

Usage

+

Usage

The partners cc and bcc from company form will be used to fill in mail composer form.

@@ -428,7 +423,7 @@

Usage

image1
-

Bug Tracker

+

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -436,17 +431,17 @@

Bug Tracker

Do not contact contributors directly about support or help with technical issues.

-

Authors

+

Authors

  • Camptocamp
-

Contributors

+

Contributors

  • Trobz:

    @@ -457,17 +452,15 @@

    Contributors

-
  • Alberto Nieto alberto.nieto@braintec.com (https://braintec.com)

    -
  • -

    Other credits

    -

    The creation and migration of this module from 16.0 to 17.0, and then -17.0 to 18.0 were financially supported by Camptocamp.

    +

    Other credits

    +

    The creation and migration from 16.0 to 17.0 of this module were +financially supported by Camptocamp.

    -
    diff --git a/mail_composer_cc_bcc/tests/test_mail_cc_bcc.py b/mail_composer_cc_bcc/tests/test_mail_cc_bcc.py index 009bfe0a5..f0d76b985 100644 --- a/mail_composer_cc_bcc/tests/test_mail_cc_bcc.py +++ b/mail_composer_cc_bcc/tests/test_mail_cc_bcc.py @@ -159,54 +159,6 @@ def test_template_cc_bcc(self): expecting = self.partner_cc2 + self.partner_bcc self.assertEqual(composer.partner_bcc_ids, expecting) - def test_template_cc_bcc_with_placeholders(self): - """Test that template with placeholders for email_cc and email_bcc""" - # Add child record to test_record - self.test_record.child_ids |= ( - self.partner_cc + self.partner_cc2 + self.partner_cc3 - ) - - # Partner template values - tmpl_model = self.env["ir.model"].search([("model", "=", "res.partner")]) - vals = { - "name": "Product Template: Re: [E-COM11] Cabinet with Doors", - "model_id": tmpl_model.id, - "subject": "Re: [E-COM11] Cabinet with Doors", - "body_html": """

    -Test Template

    """, - # Use placeholders - "email_cc": "{{ ','.join(object.mapped('child_ids.email')) }}", - "email_bcc": "{{ ','.join(object.mapped('child_ids.email')) }}", - } - partner_tmpl = self.env["mail.template"].create(vals) - - # Open mail composer form and check for default values from company - form = self.open_mail_composer_form() - composer = form.save() - - form = Form(composer) - form.template_id = partner_tmpl - composer = form.save() - expecting = self.partner_cc + self.partner_cc2 + self.partner_cc3 - - self.assertEqual(composer.partner_cc_ids, expecting) - self.assertEqual(composer.partner_bcc_ids, expecting) - # But not add Marc Demo from cc field to partner_ids field - self.assertEqual(len(composer.partner_ids), 1) - self.assertEqual(composer.partner_ids.display_name, "Test") - - # Selecting the template again doesn't add as the partners already - # in the list - form = Form(composer) - form.template_id = self.env["mail.template"] - form.save() - self.assertFalse(form.template_id) # no template - - form.template_id = partner_tmpl - composer = form.save() - self.assertEqual(composer.partner_cc_ids, expecting) - self.assertEqual(composer.partner_bcc_ids, expecting) - def set_company(self): company = self.env.company # Company default values diff --git a/mail_composer_cc_bcc/wizards/mail_compose_message.py b/mail_composer_cc_bcc/wizards/mail_compose_message.py index 3ae6aafa2..741f06c8c 100644 --- a/mail_composer_cc_bcc/wizards/mail_compose_message.py +++ b/mail_composer_cc_bcc/wizards/mail_compose_message.py @@ -55,22 +55,11 @@ def _compute_partner_cc_bcc_ids(self): and composer.composition_mode == "comment" and not composer.composition_batch ): - res_ids = composer._evaluate_res_ids() or [0] - rendered_values = composer._generate_template_for_composer( - res_ids, - {"email_cc"}, - find_or_create_partners=False, - )[res_ids[0]] composer._set_partner_ids_from_mails( - rendered_values.get("email_cc"), "partner_cc_ids" + composer.template_id.email_cc, "partner_cc_ids" ) - rendered_values = composer._generate_template_for_composer( - res_ids, - {"email_bcc"}, - find_or_create_partners=False, - )[res_ids[0]] composer._set_partner_ids_from_mails( - rendered_values.get("email_bcc"), "partner_bcc_ids" + composer.template_id.email_bcc, "partner_bcc_ids" ) elif composer.parent_id and composer.composition_mode == "comment": composer.partner_cc_ids = composer.parent_id.partner_cc_ids