diff --git a/mail_composer_cc_bcc_mail_tracking/README.rst b/mail_composer_cc_bcc_mail_tracking/README.rst new file mode 100644 index 000000000..351357ab7 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/README.rst @@ -0,0 +1,102 @@ +================================ +Email CC and BCC - Mail Tracking +================================ + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:9bb139a8dbb259124cce7e434cd4dd8bb1248d51cc15b6d5f31af3a81e8684bd + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |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/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 + :target: https://github.com/OCA/mail/tree/18.0/mail_composer_cc_bcc_mail_tracking + :alt: OCA/mail +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_composer_cc_bcc_mail_tracking + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/mail&target_branch=18.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +Glue module between + +- `mail_composer_cc_bcc <../mail_composer_cc_bcc>`__ +- `mail_tracking <../mail_tracking>`__. + +It shows, in the chatter, which recipients were in To, Cc and Bcc for +each sent message, reusing mail_tracking's clickable recipient widget. + +Features +-------- + +- The "To" line rendered by mail_tracking becomes collapsible: + + - shows all recipients + - expanding it splits them into To / Cc / Bcc + +- Global setting to choose which one is the default (collapsed or + expanded) +- Global setting to choose whether or not we can collapse from one mode + to the other + +.. IMPORTANT:: + This is an alpha version, the data model and design can change at any time without warning. + Only for development or testing purpose, do not use in production. + `More details on development status `_ + +**Table of contents** + +.. contents:: + :local: + +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 +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +------- + +* Camptocamp + +Contributors +------------ + +- `Camptocamp `__: + + - David Gallay + +Maintainers +----------- + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +This module is part of the `OCA/mail `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_composer_cc_bcc_mail_tracking/__init__.py b/mail_composer_cc_bcc_mail_tracking/__init__.py new file mode 100644 index 000000000..0650744f6 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/__init__.py @@ -0,0 +1 @@ +from . import models diff --git a/mail_composer_cc_bcc_mail_tracking/__manifest__.py b/mail_composer_cc_bcc_mail_tracking/__manifest__.py new file mode 100644 index 000000000..b9b0c8a5e --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/__manifest__.py @@ -0,0 +1,29 @@ +# Copyright 2026 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +{ + "name": "Email CC and BCC - Mail Tracking", + "summary": "Show Cc/Bcc recipients below the To line in the chatter.", + "version": "18.0.1.0.0", + "development_status": "Alpha", + "category": "Social", + "website": "https://github.com/OCA/mail", + "author": "Camptocamp, Odoo Community Association (OCA)", + "license": "AGPL-3", + "application": False, + "installable": True, + "auto_install": True, + "depends": [ + "mail_composer_cc_bcc", + "mail_tracking", + ], + "data": [ + "views/res_config_settings_views.xml", + ], + "assets": { + "web.assets_backend": [ + "mail_composer_cc_bcc_mail_tracking/static/src/message_model.esm.js", + "mail_composer_cc_bcc_mail_tracking/static/src/message.esm.js", + "mail_composer_cc_bcc_mail_tracking/static/src/message.xml", + ], + }, +} diff --git a/mail_composer_cc_bcc_mail_tracking/models/__init__.py b/mail_composer_cc_bcc_mail_tracking/models/__init__.py new file mode 100644 index 000000000..5295ca124 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/models/__init__.py @@ -0,0 +1,3 @@ +from . import res_company +from . import res_config_settings +from . import mail_message diff --git a/mail_composer_cc_bcc_mail_tracking/models/mail_message.py b/mail_composer_cc_bcc_mail_tracking/models/mail_message.py new file mode 100644 index 000000000..18c6bf21c --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/models/mail_message.py @@ -0,0 +1,65 @@ +# Copyright 2026 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import models + +from odoo.addons.mail.tools.discuss import Store + + +class MailMessage(models.Model): + _inherit = "mail.message" + + def tracking_status(self): + res = super().tracking_status() + + # Flag each recipient as Cc/Bcc using the + # partner-based recipient_cc_ids / recipient_bcc_ids + # (authoritative, set by the mail composer). + # Recipients themselves are already listed + # by super() through notified_partner_ids. + to_ids = set(self.partner_ids.ids) + cc_ids = set(self.recipient_cc_ids.ids) + bcc_ids = set(self.recipient_bcc_ids.ids) + for tracking in res: + pid = tracking.get("partner_id") + is_cc = pid in cc_ids + is_bcc = pid in bcc_ids + # A recipient is "To" when explicitly in partner_ids, or when it is + # neither Cc nor Bcc (followers / notified partners). A partner may + # belong to several lists at once. + tracking.update( + { + "isTo": pid in to_ids or not (is_cc or is_bcc), + "isCc": is_cc, + "isBcc": is_bcc, + } + ) + return res + + def _recipients_display_company(self): + """Company whose settings drive the chatter recipients display.""" + self.ensure_one() + return self.record_company_id or self.env.company + + def _recipients_default_expanded(self): + """Whether the To/Cc/Bcc split is shown by default (else single 'To').""" + self.ensure_one() + company = self._recipients_display_company() + return company.chatter_recipients_default_display == "expanded" + + def _recipients_allow_toggle(self): + """Whether the user may switch between the collapsed and expanded views.""" + self.ensure_one() + return self._recipients_display_company().chatter_recipients_allow_toggle + + def _extras_to_store(self, store: Store, format_reply): + res = super()._extras_to_store(store, format_reply=format_reply) + for message in self: + store.add( + message, + { + "recipientsDefaultExpanded": message._recipients_default_expanded(), + "recipientsAllowToggle": message._recipients_allow_toggle(), + }, + ) + return res diff --git a/mail_composer_cc_bcc_mail_tracking/models/res_company.py b/mail_composer_cc_bcc_mail_tracking/models/res_company.py new file mode 100644 index 000000000..f6690a7f6 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/models/res_company.py @@ -0,0 +1,26 @@ +# Copyright 2026 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResCompany(models.Model): + _inherit = "res.company" + + chatter_recipients_default_display = fields.Selection( + selection=[ + ("collapsed", "Single 'To' line"), + ("expanded", "To / Cc / Bcc split"), + ], + string="Default recipient display", + default="collapsed", + required=True, + help="How chatter recipients are shown by default: a single collapsed " + "'To' line, or the full To/Cc/Bcc split.", + ) + chatter_recipients_allow_toggle = fields.Boolean( + string="Allow toggling chatter recipients", + default=True, + help="Let users switch between the single 'To' line and the full " + "To/Cc/Bcc display. When disabled, only the default display is shown.", + ) diff --git a/mail_composer_cc_bcc_mail_tracking/models/res_config_settings.py b/mail_composer_cc_bcc_mail_tracking/models/res_config_settings.py new file mode 100644 index 000000000..af256b626 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/models/res_config_settings.py @@ -0,0 +1,18 @@ +# Copyright 2026 Camptocamp SA +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). + +from odoo import fields, models + + +class ResConfigSettings(models.TransientModel): + _inherit = "res.config.settings" + + chatter_recipients_default_display = fields.Selection( + related="company_id.chatter_recipients_default_display", + readonly=False, + required=True, + ) + chatter_recipients_allow_toggle = fields.Boolean( + related="company_id.chatter_recipients_allow_toggle", + readonly=False, + ) diff --git a/mail_composer_cc_bcc_mail_tracking/pyproject.toml b/mail_composer_cc_bcc_mail_tracking/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_composer_cc_bcc_mail_tracking/readme/CONTRIBUTORS.md b/mail_composer_cc_bcc_mail_tracking/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..8a35f06b5 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- [Camptocamp](https://www.camptocamp.com): + - David Gallay \<\> diff --git a/mail_composer_cc_bcc_mail_tracking/readme/DESCRIPTION.md b/mail_composer_cc_bcc_mail_tracking/readme/DESCRIPTION.md new file mode 100644 index 000000000..8096fa72a --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/readme/DESCRIPTION.md @@ -0,0 +1,14 @@ +Glue module between +- [mail_composer_cc_bcc](../mail_composer_cc_bcc) +- [mail_tracking](../mail_tracking). + +It shows, in the chatter, which recipients were in To, Cc and Bcc for each +sent message, reusing mail_tracking's clickable recipient widget. + +## Features + +- The "To" line rendered by mail_tracking becomes collapsible: + - shows all recipients + - expanding it splits them into To / Cc / Bcc +- Global setting to choose which one is the default (collapsed or expanded) +- Global setting to choose whether or not we can collapse from one mode to the other diff --git a/mail_composer_cc_bcc_mail_tracking/static/description/index.html b/mail_composer_cc_bcc_mail_tracking/static/description/index.html new file mode 100644 index 000000000..3b3b0a4d5 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/static/description/index.html @@ -0,0 +1,447 @@ + + + + + +Email CC and BCC - Mail Tracking + + + +
+

Email CC and BCC - Mail Tracking

+ + +

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

+

Glue module between

+ +

It shows, in the chatter, which recipients were in To, Cc and Bcc for +each sent message, reusing mail_tracking’s clickable recipient widget.

+
+

Features

+
    +
  • The “To” line rendered by mail_tracking becomes collapsible:
      +
    • shows all recipients
    • +
    • expanding it splits them into To / Cc / Bcc
    • +
    +
  • +
  • Global setting to choose which one is the default (collapsed or +expanded)
  • +
  • Global setting to choose whether or not we can collapse from one mode +to the other
  • +
+
+

Important

+

This is an alpha version, the data model and design can change at any time without warning. +Only for development or testing purpose, do not use in production. +More details on development status

+
+

Table of contents

+ +
+

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 +feedback.

+

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

+
+ +
+
+

Authors

+
    +
  • Camptocamp
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+ +Odoo Community Association + +

OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use.

+

This module is part of the OCA/mail project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+ + diff --git a/mail_composer_cc_bcc_mail_tracking/static/src/message.esm.js b/mail_composer_cc_bcc_mail_tracking/static/src/message.esm.js new file mode 100644 index 000000000..9f621fef8 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/static/src/message.esm.js @@ -0,0 +1,30 @@ +import {Message} from "@mail/core/common/message"; +import {patch} from "@web/core/utils/patch"; +import {useState} from "@odoo/owl"; + +patch(Message.prototype, { + setup() { + super.setup(...arguments); + // Default view (single "To" vs full To/Cc/Bcc) comes from the company + // setting exposed on the message. + this.ccBccState = useState({expanded: this.message.recipientsDefaultExpanded}); + }, + get recipientsToggleAllowed() { + return this.message.recipientsAllowToggle; + }, + get toTrackings() { + return (this.message.partner_trackings || []).filter((t) => t.isTo); + }, + get ccTrackings() { + return (this.message.partner_trackings || []).filter((t) => t.isCc); + }, + get bccTrackings() { + return (this.message.partner_trackings || []).filter((t) => t.isBcc); + }, + toggleCcBcc() { + if (!this.recipientsToggleAllowed) { + return; + } + this.ccBccState.expanded = !this.ccBccState.expanded; + }, +}); diff --git a/mail_composer_cc_bcc_mail_tracking/static/src/message.xml b/mail_composer_cc_bcc_mail_tracking/static/src/message.xml new file mode 100644 index 000000000..63fdbadb5 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/static/src/message.xml @@ -0,0 +1,60 @@ + + + + + +

+ To: + + + +

+

+ Cc: + +

+

+ Bcc: + +

+
+
+
diff --git a/mail_composer_cc_bcc_mail_tracking/static/src/message_model.esm.js b/mail_composer_cc_bcc_mail_tracking/static/src/message_model.esm.js new file mode 100644 index 000000000..18d759d9e --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/static/src/message_model.esm.js @@ -0,0 +1,11 @@ +import {Message} from "@mail/core/common/message_model"; +import {Record} from "@mail/core/common/record"; +import {patch} from "@web/core/utils/patch"; + +patch(Message.prototype, { + setup() { + super.setup(...arguments); + this.recipientsDefaultExpanded = Record.attr(false); + this.recipientsAllowToggle = Record.attr(true); + }, +}); diff --git a/mail_composer_cc_bcc_mail_tracking/views/res_config_settings_views.xml b/mail_composer_cc_bcc_mail_tracking/views/res_config_settings_views.xml new file mode 100644 index 000000000..cf3874674 --- /dev/null +++ b/mail_composer_cc_bcc_mail_tracking/views/res_config_settings_views.xml @@ -0,0 +1,26 @@ + + + + res.config.settings.form.chatter.recipients + res.config.settings + + + + + + + + + + + + + + +