diff --git a/.copier-answers.yml b/.copier-answers.yml index 4aaa546ac3..70adac268c 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Do NOT update manually; changes here will be overwritten by Copier -_commit: v1.29 +_commit: v1.38 _src_path: gh:oca/oca-addons-repo-template ci: GitHub convert_readme_fragments_to_markdown: false @@ -18,7 +18,8 @@ org_name: Odoo Community Association (OCA) org_slug: OCA rebel_module_groups: - mail_post_defer -repo_description: '{''TODO'': ''add repo description.''}' +repo_description: '{''TODO'': ''add repo description.''}Better integration of Odoo + with mail and social media' repo_name: social repo_slug: social repo_website: https://github.com/OCA/social diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..e0d56685a9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +test-requirements.txt merge=union diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index afd7524ef0..5e6c3fb439 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -17,6 +17,7 @@ jobs: - uses: actions/setup-python@v5 with: python-version: "3.11" + cache: 'pip' - name: Get python version run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV - uses: actions/cache@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b7736f505..2ad199a9c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -51,7 +51,7 @@ jobs: makepot: "true" services: postgres: - image: postgres:12.0 + image: postgres:12 env: POSTGRES_USER: odoo POSTGRES_PASSWORD: odoo @@ -75,6 +75,13 @@ jobs: run: oca_init_test_database - name: Run tests run: oca_run_tests + - name: Upload screenshots from JS tests + uses: actions/upload-artifact@v4 + if: ${{ failure() }} + with: + name: Screenshots of failed JS tests - ${{ matrix.name }}${{ join(matrix.include) }} + path: /tmp/odoo_tests/${{ env.PGDATABASE }} + if-no-files-found: ignore - uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8647d7aa24..1f66edd221 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,7 +39,7 @@ repos: language: fail files: '[a-zA-Z0-9_]*/i18n/en\.po$' - repo: https://github.com/oca/maintainer-tools - rev: d5fab7ee87fceee858a3d01048c78a548974d935 + rev: f9b919b9868143135a9c9cb03021089cabba8223 hooks: # update the NOT INSTALLABLE ADDONS section above - id: oca-update-pre-commit-excluded-addons @@ -104,6 +104,7 @@ repos: additional_dependencies: - "eslint@8.24.0" - "eslint-plugin-jsdoc@" + - "globals@" - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.3.0 hooks: @@ -140,7 +141,7 @@ repos: - --settings=. exclude: /__init__\.py$ - repo: https://github.com/acsone/setuptools-odoo - rev: 3.1.8 + rev: 3.3.2 hooks: - id: setuptools-odoo-make-default - id: setuptools-odoo-get-requirements diff --git a/.pylintrc b/.pylintrc index 554913276b..0a521c31ff 100644 --- a/.pylintrc +++ b/.pylintrc @@ -25,19 +25,25 @@ disable=all enable=anomalous-backslash-in-string, api-one-deprecated, api-one-multi-together, - assignment-from-none, - attribute-deprecated, class-camelcase, - dangerous-default-value, dangerous-view-replace-wo-priority, - development-status-allowed, duplicate-id-csv, - duplicate-key, duplicate-xml-fields, duplicate-xml-record-id, eval-referenced, - eval-used, incoherent-interpreter-exec-perm, + openerp-exception-warning, + redundant-modulename-xml, + relative-import, + rst-syntax-error, + wrong-tabs-instead-of-spaces, + xml-syntax-error, + assignment-from-none, + attribute-deprecated, + dangerous-default-value, + development-status-allowed, + duplicate-key, + eval-used, license-allowed, manifest-author-string, manifest-deprecated-key, @@ -48,73 +54,68 @@ enable=anomalous-backslash-in-string, method-inverse, method-required-super, method-search, - openerp-exception-warning, pointless-statement, pointless-string-statement, print-used, redundant-keyword-arg, - redundant-modulename-xml, reimported, - relative-import, return-in-init, - rst-syntax-error, sql-injection, too-few-format-args, translation-field, translation-required, unreachable, use-vim-comment, - wrong-tabs-instead-of-spaces, - xml-syntax-error, - attribute-string-redundant, character-not-valid-in-resource-link, - consider-merging-classes-inherited, - context-overridden, create-user-wo-reset-password, dangerous-filter-wo-user, dangerous-qweb-replace-wo-priority, deprecated-data-xml-node, deprecated-openerp-xml-node, duplicate-po-message-definition, - except-pass, file-not-used, + missing-newline-extrafiles, + old-api7-method-defined, + po-msgstr-variables, + po-syntax-error, + str-format-used, + unnecessary-utf8-coding-comment, + xml-attribute-translatable, + xml-deprecated-qweb-directive, + xml-deprecated-tree-attribute, + attribute-string-redundant, + consider-merging-classes-inherited, + context-overridden, + except-pass, invalid-commit, manifest-maintainers-list, - missing-newline-extrafiles, missing-readme, missing-return, odoo-addons-relative-import, - old-api7-method-defined, - po-msgstr-variables, - po-syntax-error, renamed-field-parameter, resource-not-exist, - str-format-used, test-folder-imported, translation-contains-variable, translation-positional-used, - unnecessary-utf8-coding-comment, website-manifest-key-not-valid-uri, - xml-attribute-translatable, - xml-deprecated-qweb-directive, - xml-deprecated-tree-attribute, external-request-timeout, - # messages that do not cause the lint step to fail - consider-merging-classes-inherited, + missing-manifest-dependency, + too-complex,, create-user-wo-reset-password, dangerous-filter-wo-user, - deprecated-module, file-not-used, - invalid-commit, - missing-manifest-dependency, missing-newline-extrafiles, - missing-readme, no-utf8-coding-comment, - odoo-addons-relative-import, old-api7-method-defined, + unnecessary-utf8-coding-comment, + # messages that do not cause the lint step to fail + consider-merging-classes-inherited, + deprecated-module, + invalid-commit, + missing-readme, + odoo-addons-relative-import, redefined-builtin, - too-complex, - unnecessary-utf8-coding-comment + manifest-external-assets [REPORTS] diff --git a/.pylintrc-mandatory b/.pylintrc-mandatory index 7a0cd4efef..098393aadb 100644 --- a/.pylintrc-mandatory +++ b/.pylintrc-mandatory @@ -17,19 +17,25 @@ disable=all enable=anomalous-backslash-in-string, api-one-deprecated, api-one-multi-together, - assignment-from-none, - attribute-deprecated, class-camelcase, - dangerous-default-value, dangerous-view-replace-wo-priority, - development-status-allowed, duplicate-id-csv, - duplicate-key, duplicate-xml-fields, duplicate-xml-record-id, eval-referenced, - eval-used, incoherent-interpreter-exec-perm, + openerp-exception-warning, + redundant-modulename-xml, + relative-import, + rst-syntax-error, + wrong-tabs-instead-of-spaces, + xml-syntax-error, + assignment-from-none, + attribute-deprecated, + dangerous-default-value, + development-status-allowed, + duplicate-key, + eval-used, license-allowed, manifest-author-string, manifest-deprecated-key, @@ -40,56 +46,50 @@ enable=anomalous-backslash-in-string, method-inverse, method-required-super, method-search, - openerp-exception-warning, pointless-statement, pointless-string-statement, print-used, redundant-keyword-arg, - redundant-modulename-xml, reimported, - relative-import, return-in-init, - rst-syntax-error, sql-injection, too-few-format-args, translation-field, translation-required, unreachable, use-vim-comment, - wrong-tabs-instead-of-spaces, - xml-syntax-error, - attribute-string-redundant, character-not-valid-in-resource-link, - consider-merging-classes-inherited, - context-overridden, create-user-wo-reset-password, dangerous-filter-wo-user, dangerous-qweb-replace-wo-priority, deprecated-data-xml-node, deprecated-openerp-xml-node, duplicate-po-message-definition, - except-pass, file-not-used, + missing-newline-extrafiles, + old-api7-method-defined, + po-msgstr-variables, + po-syntax-error, + str-format-used, + unnecessary-utf8-coding-comment, + xml-attribute-translatable, + xml-deprecated-qweb-directive, + xml-deprecated-tree-attribute, + attribute-string-redundant, + consider-merging-classes-inherited, + context-overridden, + except-pass, invalid-commit, manifest-maintainers-list, - missing-newline-extrafiles, missing-readme, missing-return, odoo-addons-relative-import, - old-api7-method-defined, - po-msgstr-variables, - po-syntax-error, renamed-field-parameter, resource-not-exist, - str-format-used, test-folder-imported, translation-contains-variable, translation-positional-used, - unnecessary-utf8-coding-comment, website-manifest-key-not-valid-uri, - xml-attribute-translatable, - xml-deprecated-qweb-directive, - xml-deprecated-tree-attribute, external-request-timeout [REPORTS] diff --git a/README.md b/README.md index 0bcc11084f..bf2cbc0542 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ +[![Support the OCA](https://odoo-community.org/readme-banner-image)](https://odoo-community.org/get-involved?utm_source=repo-readme) + +# social [![Runboat](https://img.shields.io/badge/runboat-Try%20me-875A7B.png)](https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0) [![Pre-commit Status](https://github.com/OCA/social/actions/workflows/pre-commit.yml/badge.svg?branch=16.0)](https://github.com/OCA/social/actions/workflows/pre-commit.yml?query=branch%3A16.0) [![Build Status](https://github.com/OCA/social/actions/workflows/test.yml/badge.svg?branch=16.0)](https://github.com/OCA/social/actions/workflows/test.yml?query=branch%3A16.0) @@ -7,9 +10,7 @@ -# social - -{'TODO': 'add repo description.'} +{'TODO': 'add repo description.'}Better integration of Odoo with mail and social media @@ -23,7 +24,7 @@ addon | version | maintainers | summary --- | --- | --- | --- [base_search_mail_content](base_search_mail_content/) | 16.0.1.0.5 | | Base Search Mail Content [base_user_signature](base_user_signature/) | 16.0.1.0.0 | imlopes | Base User Signature -[email_template_qweb](email_template_qweb/) | 16.0.1.0.0 | | Use the QWeb templating mechanism for emails +[email_template_qweb](email_template_qweb/) | 16.0.1.0.1 | | Use the QWeb templating mechanism for emails [fetchmail_thread_default](fetchmail_thread_default/) | 16.0.1.1.0 | | Post unkonwn messages to an existing thread [mail_activity_board](mail_activity_board/) | 16.0.1.2.0 | | Add Activity Boards [mail_activity_done](mail_activity_done/) | 16.0.1.3.0 | | Mail Activity Done diff --git a/email_template_qweb/README.rst b/email_template_qweb/README.rst index e18d04e4df..857a12cd57 100644 --- a/email_template_qweb/README.rst +++ b/email_template_qweb/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + ======================== QWeb for email templates ======================== @@ -7,13 +11,13 @@ QWeb for email templates !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:f34eb5d597bb6e375fee10d4f9edc4908631034be7f187d151cd0deaedd3cfa3 + !! source digest: sha256:000803815bf117944f0c540dc558a7353df8bd4cf6fb7b1a47c03859792bc696 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-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%2Fsocial-lightgray.png?logo=github diff --git a/email_template_qweb/__manifest__.py b/email_template_qweb/__manifest__.py index 495bf0fb80..813d53a164 100644 --- a/email_template_qweb/__manifest__.py +++ b/email_template_qweb/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "QWeb for email templates", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "author": "Therp BV, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Marketing", diff --git a/email_template_qweb/models/mail_template.py b/email_template_qweb/models/mail_template.py index 54d4911cce..49676d2ebc 100644 --- a/email_template_qweb/models/mail_template.py +++ b/email_template_qweb/models/mail_template.py @@ -1,4 +1,4 @@ -# Copyright 2016 Therp BV +# Copyright 2016-2026 Therp BV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). from odoo import fields, models, tools @@ -17,36 +17,28 @@ class MailTemplate(models.Model): def generate_email(self, res_ids, fields): multi_mode = True - IrQweb = self.env["ir.qweb"] - if isinstance(res_ids, int): res_ids = [res_ids] multi_mode = False - result = super(MailTemplate, self).generate_email(res_ids, fields=fields) - for lang, (_template, _template_res_ids) in self._classify_per_lang( + result = super().generate_email(res_ids, fields=fields) + if self.body_type != "qweb_view" or (fields and "body_html" not in fields): + return result if multi_mode else result[res_ids[0]] + for lang, (_template, template_res_ids) in self._classify_per_lang( res_ids ).items(): self_with_lang = self.with_context(lang=lang) - for res_id in res_ids: - if self.body_type == "qweb_view" and ( - not fields or "body_html" in fields - ): - for record in self_with_lang.env[self.model].browse(res_id): - body_html = IrQweb._render( - self_with_lang.body_view_id.id, - {"object": record, "email_template": self_with_lang}, - ) - # Some wizards, like when sending a sales order, need this - # fix to display accents correctly - body_html = tools.ustr(body_html) - result[res_id][ - "body_html" - ] = self_with_lang._render_template_postprocess( - {res_id: body_html} - )[ - res_id - ] - result[res_id]["body"] = tools.html_sanitize( - result[res_id]["body_html"] - ) + IrQweb = self_with_lang.env["ir.qweb"] + for res_id in template_res_ids: + record = self_with_lang.env[self_with_lang.model].browse(res_id) + result_res_id = result[res_id] + body_html = IrQweb._render( + self_with_lang.body_view_id.id, + {"object": record, "email_template": self_with_lang}, + ) + body_html = tools.ustr(body_html) + rendered_post_temp = self_with_lang._render_template_postprocess( + {res_id: body_html} + ) + result_res_id["body_html"] = rendered_post_temp[res_id] + result_res_id["body"] = tools.html_sanitize(result_res_id["body_html"]) return result if multi_mode else result[res_ids[0]] diff --git a/email_template_qweb/static/description/index.html b/email_template_qweb/static/description/index.html index 59f2e5b81d..7b4f335990 100644 --- a/email_template_qweb/static/description/index.html +++ b/email_template_qweb/static/description/index.html @@ -1,18 +1,18 @@ - -QWeb for email templates +README.rst -
-

QWeb for email templates

+
+ + +Odoo Community Association + +
+

QWeb for email templates

-

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

This module was written to allow you to write email templates in QWeb view instead of QWeb. The advantage here is that with QWeb View, you can make use of inheritance and the call statement, which allows you to reuse designs and @@ -390,7 +395,7 @@

QWeb for email templates

-

Usage

+

Usage

To use this module, you need to:

  1. Select QWeb View in the field Body templating engine
  2. @@ -399,7 +404,7 @@

    Usage

-

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 @@ -407,15 +412,15 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • Therp BV
-

Contributors

+

Contributors

-

Other credits

+

Other credits

The development of this module has been financially supported by:

  • Camptocamp
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +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.

@@ -465,5 +472,6 @@

Maintainers

+
diff --git a/mail_activity_done/i18n/tr.po b/mail_activity_done/i18n/tr.po new file mode 100644 index 0000000000..3217b9e934 --- /dev/null +++ b/mail_activity_done/i18n/tr.po @@ -0,0 +1,75 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * mail_activity_done +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: Automatically generated\n" +"Language-Team: none\n" +"Language: tr\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" + +#. module: mail_activity_done +#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__active +msgid "Active" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model.fields,field_description:mail_activity_done.field_account_bank_statement_line__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_account_journal__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_account_move__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_account_payment__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_account_setup_bank_manual_config__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_event_event__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_event_registration__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity_mixin__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_mailing_mailing__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_product_product__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_product_template__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_res_partner_bank__activity_ids +#: model:ir.model.fields,field_description:mail_activity_done.field_res_users__activity_ids +msgid "Activities" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model,name:mail_activity_done.model_mail_activity +msgid "Activity" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model,name:mail_activity_done.model_mail_activity_mixin +msgid "Activity Mixin" +msgstr "" + +#. module: mail_activity_done +#: model_terms:ir.ui.view,arch_db:mail_activity_done.mail_activity_view_search +#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail +msgid "Completed Activities" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__date_done +msgid "Completed Date" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__done +#: model:ir.model.fields.selection,name:mail_activity_done.selection__mail_activity__state__done +msgid "Done" +msgstr "" + +#. module: mail_activity_done +#: model_terms:ir.ui.view,arch_db:mail_activity_done.res_partner_view_search_inherit_mail +msgid "Open Activities" +msgstr "" + +#. module: mail_activity_done +#: model:ir.model.fields,field_description:mail_activity_done.field_mail_activity__state +msgid "State" +msgstr "" diff --git a/mail_attach_existing_attachment/README.rst b/mail_attach_existing_attachment/README.rst index bc5c76d59f..179056eca0 100644 --- a/mail_attach_existing_attachment/README.rst +++ b/mail_attach_existing_attachment/README.rst @@ -1,3 +1,7 @@ +.. image:: https://odoo-community.org/readme-banner-image + :target: https://odoo-community.org/get-involved?utm_source=readme + :alt: Odoo Community Association + =============================== Mail Attach Existing Attachment =============================== @@ -13,7 +17,7 @@ Mail Attach Existing Attachment .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status :alt: Beta -.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png +.. |badge2| image:: https://img.shields.io/badge/license-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%2Fsocial-lightgray.png?logo=github @@ -28,8 +32,16 @@ Mail Attach Existing Attachment |badge1| |badge2| |badge3| |badge4| |badge5| -This module was written to add the possibility to add attachments located on -the object by sending it by email with the mail compose message wizard +This module extends the mail compose message wizard to allow selecting +existing attachments when sending an email. + +It provides two attachment selection mechanisms: + +* Object Attachments — attachments linked to the current record. +* Model Attachments — attachments linked to other records of the same model. + +This makes it possible to reuse documents already stored on other +records of the same model without re-uploading them. **Table of contents** @@ -46,7 +58,13 @@ To use this module, you need to: .. figure:: https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/attachment.png :alt: Attachment on purchase order -* Then, by sending the object via email, you can select the attachment added earlier +* Optionally, add attachments on other records of the same model + (for example, on another Purchase Order or Partner record). + +* Then, by sending the object via email, you can: + + * Select attachments linked to the current object. + * Select attachments linked to other records of the same model. .. figure:: https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png :alt: Sends the Purchase Order by email @@ -54,7 +72,7 @@ To use this module, you need to: Known issues / Roadmap ====================== -* The module only allows the addition of attachments linked to the object. +* Model attachments are filtered by model but not further restricted. Bug Tracker =========== @@ -74,6 +92,7 @@ Authors * ACSONE SA/NV * Tecnativa +* Therp BV Contributors ~~~~~~~~~~~~ @@ -84,6 +103,9 @@ Contributors * Sergio Teruel * Ernesto Tejeda +* `Therp BV `_: + + * Nikos Tsirintanis Maintainers ~~~~~~~~~~~ diff --git a/mail_attach_existing_attachment/__manifest__.py b/mail_attach_existing_attachment/__manifest__.py index 16446dd3f0..b2bfea8c0e 100644 --- a/mail_attach_existing_attachment/__manifest__.py +++ b/mail_attach_existing_attachment/__manifest__.py @@ -1,13 +1,14 @@ # Copyright 2015 ACSONE SA/NV +# Copyright 2026 Therp BV . # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). { "name": "Mail Attach Existing Attachment", - "summary": "Adding attachment on the object by sending this one", - "author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)", + "summary": "Attach existing object or model attachments in mail composer", + "author": "ACSONE SA/NV, Tecnativa, Therp BV, Odoo Community Association (OCA)", "website": "https://github.com/OCA/social", "category": "Social Network", - "version": "16.0.1.1.0", + "version": "16.0.2.0.0", "license": "AGPL-3", "depends": ["mail"], "data": ["wizard/mail_compose_message_view.xml"], diff --git a/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst b/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst index 4113412635..bfd1821df4 100644 --- a/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst +++ b/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst @@ -4,3 +4,6 @@ * Sergio Teruel * Ernesto Tejeda +* `Therp BV `_: + + * Nikos Tsirintanis diff --git a/mail_attach_existing_attachment/readme/DESCRIPTION.rst b/mail_attach_existing_attachment/readme/DESCRIPTION.rst index 189719c21e..ae6c369062 100644 --- a/mail_attach_existing_attachment/readme/DESCRIPTION.rst +++ b/mail_attach_existing_attachment/readme/DESCRIPTION.rst @@ -1,2 +1,10 @@ -This module was written to add the possibility to add attachments located on -the object by sending it by email with the mail compose message wizard +This module extends the mail compose message wizard to allow selecting +existing attachments when sending an email. + +It provides two attachment selection mechanisms: + +* Object Attachments — attachments linked to the current record. +* Model Attachments — attachments linked to other records of the same model. + +This makes it possible to reuse documents already stored on other +records of the same model without re-uploading them. diff --git a/mail_attach_existing_attachment/readme/ROADMAP.rst b/mail_attach_existing_attachment/readme/ROADMAP.rst index 5d24095fd1..12725394b8 100644 --- a/mail_attach_existing_attachment/readme/ROADMAP.rst +++ b/mail_attach_existing_attachment/readme/ROADMAP.rst @@ -1 +1 @@ -* The module only allows the addition of attachments linked to the object. +* Model attachments are filtered by model but not further restricted. diff --git a/mail_attach_existing_attachment/readme/USAGE.rst b/mail_attach_existing_attachment/readme/USAGE.rst index 68fac75449..040d6ba095 100644 --- a/mail_attach_existing_attachment/readme/USAGE.rst +++ b/mail_attach_existing_attachment/readme/USAGE.rst @@ -5,7 +5,13 @@ To use this module, you need to: .. figure:: ../static/description/attachment.png :alt: Attachment on purchase order -* Then, by sending the object via email, you can select the attachment added earlier +* Optionally, add attachments on other records of the same model + (for example, on another Purchase Order or Partner record). + +* Then, by sending the object via email, you can: + + * Select attachments linked to the current object. + * Select attachments linked to other records of the same model. .. figure:: ../static/description/ex_mail_compose_message.png :alt: Sends the Purchase Order by email diff --git a/mail_attach_existing_attachment/static/description/index.html b/mail_attach_existing_attachment/static/description/index.html index a798469614..a36cf584bd 100644 --- a/mail_attach_existing_attachment/static/description/index.html +++ b/mail_attach_existing_attachment/static/description/index.html @@ -3,15 +3,16 @@ -Mail Attach Existing Attachment +README.rst -
-

Mail Attach Existing Attachment

+
+ + +Odoo Community Association + +
+

Mail Attach Existing Attachment

-

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

-

This module was written to add the possibility to add attachments located on -the object by sending it by email with the mail compose message wizard

+

Beta License: AGPL-3 OCA/social Translate me on Weblate Try me on Runboat

+

This module extends the mail compose message wizard to allow selecting +existing attachments when sending an email.

+

It provides two attachment selection mechanisms:

+
    +
  • Object Attachments — attachments linked to the current record.
  • +
  • Model Attachments — attachments linked to other records of the same model.
  • +
+

This makes it possible to reuse documents already stored on other +records of the same model without re-uploading them.

Table of contents

    @@ -386,7 +399,7 @@

    Mail Attach Existing Attachment

-

Usage

+

Usage

To use this module, you need to:

  • Add some attachments on an object by creating a new Log note
  • @@ -395,20 +408,26 @@

    Usage

    Attachment on purchase order
    -
  • Then, by sending the object via email, you can select the attachment added earlier
  • +
  • Optionally, add attachments on other records of the same model +(for example, on another Purchase Order or Partner record).
  • +
  • Then, by sending the object via email, you can:
      +
    • Select attachments linked to the current object.
    • +
    • Select attachments linked to other records of the same model.
    • +
    +
Sends the Purchase Order by email
-

Known issues / Roadmap

+

Known issues / Roadmap

    -
  • The module only allows the addition of attachments linked to the object.
  • +
  • Model attachments are filtered by model but not further restricted.
-

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 @@ -416,16 +435,17 @@

Bug Tracker

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

-

Credits

+

Credits

-

Authors

+

Authors

  • ACSONE SA/NV
  • Tecnativa
  • +
  • Therp BV
-

Contributors

+

Contributors

+
  • Therp BV: +
  • -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    -Odoo Community Association + +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.

    @@ -448,5 +474,6 @@

    Maintainers

    +
    diff --git a/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py b/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py index d762a36b7a..4117d7130b 100644 --- a/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py +++ b/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py @@ -1,4 +1,5 @@ # Copyright 2015 ACSONE SA/NV +# Copyright 2026 Therp BV . # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo.tests import common @@ -16,6 +17,14 @@ def setUp(self): "parent_id": False, } ) + self.partner_02 = self.env["res.partner"].create( + { + "name": "Partner 2", + "email": "partner2@example.org", + "is_company": True, + "parent_id": False, + } + ) def test_send_email_attachment(self): attach1 = self.env["ir.attachment"].create( @@ -26,12 +35,23 @@ def test_send_email_attachment(self): "res_id": self.partner_01.id, } ) + attach2 = self.env["ir.attachment"].create( + { + "name": "Attach2", + "datas": "bW9kZWwgdGVzdA==", + "res_model": "res.partner", + "res_id": self.partner_02.id, + } + ) vals = { "model": "res.partner", "partner_ids": [(6, 0, [self.partner_01.id])], "res_id": self.partner_01.id, "object_attachment_ids": [(6, 0, [attach1.id])], + # NEW + "model_attachment_ids": [(6, 0, [attach2.id])], } mail = self.env["mail.compose.message"].create(vals) values = mail.get_mail_values([self.partner_01.id]) self.assertTrue(attach1.id in values[self.partner_01.id]["attachment_ids"]) + self.assertTrue(attach2.id in values[self.partner_01.id]["attachment_ids"]) diff --git a/mail_attach_existing_attachment/wizard/mail_compose_message.py b/mail_attach_existing_attachment/wizard/mail_compose_message.py index 671bb987c7..90f4f85bd3 100644 --- a/mail_attach_existing_attachment/wizard/mail_compose_message.py +++ b/mail_attach_existing_attachment/wizard/mail_compose_message.py @@ -1,4 +1,5 @@ # Copyright 2015 ACSONE SA/NV +# Copyright 2026 Therp BV . # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). from odoo import api, fields, models @@ -27,11 +28,20 @@ def default_get(self, fields_list): column2="attachment_id", string="Object Attachments", ) + model_attachment_ids = fields.Many2many( + comodel_name="ir.attachment", + relation="mail_compose_message_ir_attachments_model_rel", + column1="wizard_id", + column2="attachment_id", + string="Model Attachments", + ) def get_mail_values(self, res_ids): res = super().get_mail_values(res_ids) - if self.object_attachment_ids.ids and self.model and len(res_ids) == 1: - res[res_ids[0]].setdefault("attachment_ids", []).extend( - self.object_attachment_ids.ids - ) + if self.model and len(res_ids) == 1: + attachment_ids = set(res[res_ids[0]].get("attachment_ids", [])) + attachment_ids.update(self.object_attachment_ids.ids) + attachment_ids.update(self.model_attachment_ids.ids) + if attachment_ids: + res[res_ids[0]]["attachment_ids"] = list(attachment_ids) return res diff --git a/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml b/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml index 9e5efdedd5..16fe35e5a4 100644 --- a/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml +++ b/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml @@ -15,6 +15,13 @@ domain="[('res_model', '=', model), ('res_id', '=', res_id)]" attrs="{'invisible': [('can_attach_attachment', '=', False)]}" /> +