diff --git a/mail_attach_existing_attachment/README.rst b/mail_attach_existing_attachment/README.rst index bc5c76d59..ebf765ae5 100644 --- a/mail_attach_existing_attachment/README.rst +++ b/mail_attach_existing_attachment/README.rst @@ -17,19 +17,20 @@ Mail Attach Existing Attachment :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 - :target: https://github.com/OCA/social/tree/16.0/mail_attach_existing_attachment + :target: https://github.com/OCA/social/tree/17.0/mail_attach_existing_attachment :alt: OCA/social .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_attach_existing_attachment + :target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_attach_existing_attachment :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/social&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0 :alt: Try me on Runboat |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 was written to add the possibility to add attachments +located on the object by sending it by email with the mail compose +message wizard **Table of contents** @@ -41,20 +42,23 @@ Usage To use this module, you need to: -* Add some attachments on an object by creating a new *Log note* +- Add some attachments on an object by creating a new *Log note* -.. figure:: https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/attachment.png - :alt: Attachment on purchase order +|image1| -* Then, by sending the object via email, you can select the attachment added earlier +- Then, by sending the object via email, you can select the attachment + added earlier -.. 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 +|image2| + +.. |image1| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/attachment.png +.. |image2| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png Known issues / Roadmap ====================== -* The module only allows the addition of attachments linked to the object. +- The module only allows the addition of attachments linked to the + object. Bug Tracker =========== @@ -62,7 +66,7 @@ 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -70,23 +74,27 @@ Credits ======= Authors -~~~~~~~ +------- * ACSONE SA/NV * Tecnativa Contributors -~~~~~~~~~~~~ +------------ -* Adrien Peiffer -* Benoit Aimont -* `Tecnativa `_: +- Adrien Peiffer +- Benoit Aimont +- `Tecnativa `__: - * Sergio Teruel - * Ernesto Tejeda + - Sergio Teruel + - Ernesto Tejeda + +- `360ERP `__: + + - Andrea Stirpe Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -98,6 +106,6 @@ 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/social `_ project on GitHub. +This module is part of the `OCA/social `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/mail_attach_existing_attachment/pyproject.toml b/mail_attach_existing_attachment/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/mail_attach_existing_attachment/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/mail_attach_existing_attachment/readme/CONTRIBUTORS.md b/mail_attach_existing_attachment/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..39e451ea8 --- /dev/null +++ b/mail_attach_existing_attachment/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- Adrien Peiffer \<\> +- Benoit Aimont \<\> +- [Tecnativa](https://www.tecnativa.com): + - Sergio Teruel + - Ernesto Tejeda +- [360ERP](https://www.360erp.com): + - Andrea Stirpe diff --git a/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst b/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst deleted file mode 100644 index de9303d21..000000000 --- a/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,10 +0,0 @@ -* Adrien Peiffer -* Benoit Aimont -* `Tecnativa `_: - - * Sergio Teruel - * Ernesto Tejeda - -* `360ERP `_: - - * Andrea Stirpe diff --git a/mail_attach_existing_attachment/readme/DESCRIPTION.md b/mail_attach_existing_attachment/readme/DESCRIPTION.md new file mode 100644 index 000000000..8f21687eb --- /dev/null +++ b/mail_attach_existing_attachment/readme/DESCRIPTION.md @@ -0,0 +1,3 @@ +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 diff --git a/mail_attach_existing_attachment/readme/DESCRIPTION.rst b/mail_attach_existing_attachment/readme/DESCRIPTION.rst deleted file mode 100644 index 189719c21..000000000 --- a/mail_attach_existing_attachment/readme/DESCRIPTION.rst +++ /dev/null @@ -1,2 +0,0 @@ -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 diff --git a/mail_attach_existing_attachment/readme/ROADMAP.md b/mail_attach_existing_attachment/readme/ROADMAP.md new file mode 100644 index 000000000..7182847cf --- /dev/null +++ b/mail_attach_existing_attachment/readme/ROADMAP.md @@ -0,0 +1,2 @@ +- The module only allows the addition of attachments linked to the + object. diff --git a/mail_attach_existing_attachment/readme/ROADMAP.rst b/mail_attach_existing_attachment/readme/ROADMAP.rst deleted file mode 100644 index 5d24095fd..000000000 --- a/mail_attach_existing_attachment/readme/ROADMAP.rst +++ /dev/null @@ -1 +0,0 @@ -* The module only allows the addition of attachments linked to the object. diff --git a/mail_attach_existing_attachment/readme/USAGE.md b/mail_attach_existing_attachment/readme/USAGE.md new file mode 100644 index 000000000..b1bdedd95 --- /dev/null +++ b/mail_attach_existing_attachment/readme/USAGE.md @@ -0,0 +1,10 @@ +To use this module, you need to: + +- Add some attachments on an object by creating a new *Log note* + +![](../static/description/attachment.png) + +- Then, by sending the object via email, you can select the attachment + added earlier + +![](../static/description/ex_mail_compose_message.png) diff --git a/mail_attach_existing_attachment/readme/USAGE.rst b/mail_attach_existing_attachment/readme/USAGE.rst deleted file mode 100644 index 68fac7544..000000000 --- a/mail_attach_existing_attachment/readme/USAGE.rst +++ /dev/null @@ -1,11 +0,0 @@ -To use this module, you need to: - -* Add some attachments on an object by creating a new *Log note* - -.. figure:: ../static/description/attachment.png - :alt: Attachment on purchase order - -* Then, by sending the object via email, you can select the attachment added earlier - -.. 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 a79846961..719f1748f 100644 --- a/mail_attach_existing_attachment/static/description/index.html +++ b/mail_attach_existing_attachment/static/description/index.html @@ -368,9 +368,10 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:ac2a9aa40b0d4a582c625061abbe71035a0b6c6421af29465d20d9e51dcfbda3 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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 was written to add the possibility to add attachments +located on the object by sending it by email with the mail compose +message wizard

Table of contents

    @@ -391,20 +392,18 @@ the object by sending it by email with the mail compose message wizard

    • Add some attachments on an object by creating a new Log note
    -
    -Attachment on purchase order -
    +

    image1

      -
    • Then, by sending the object via email, you can select the attachment added earlier
    • +
    • Then, by sending the object via email, you can select the attachment +added earlier
    -
    -Sends the Purchase Order by email -
    +

    image2

Known issues / Roadmap

    -
  • The module only allows the addition of attachments linked to the object.
  • +
  • The module only allows the addition of attachments linked to the +object.
@@ -412,7 +411,7 @@ the object by sending it by email with the mail compose message wizard

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.

+feedback.

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

@@ -434,6 +433,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
  • Ernesto Tejeda
  • +
  • 360ERP:
      +
    • Andrea Stirpe
    • +
    +
  • @@ -443,7 +446,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

    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/social project on GitHub.

    +

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

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

    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 bf8f4ecd0..33606d0d3 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 @@ -6,10 +6,9 @@ from odoo.tests.common import Form, TransactionCase class TestMailComposer(TransactionCase): - @classmethod def setUpClass(cls): - super(TestMailComposer, cls).setUpClass() + super().setUpClass() cls.partner_01 = cls.env["res.partner"].create( { "name": "Partner 1", @@ -30,11 +29,13 @@ class TestMailComposer(TransactionCase): def test_01_send_email_attachment(self): """Test sending amail with attachment from Object Attachment of composer""" # Open email composer - composer_form = Form(self.env['mail.compose.message'].with_context({ - 'default_composition_mode': 'comment', - 'default_model': self.partner_01._name, - 'default_res_ids': self.partner_01.ids, - })) + composer_form = Form( + self.env["mail.compose.message"].with_context( + default_composition_mode="comment", + default_model=self.partner_01._name, + default_res_ids=self.partner_01.ids, + ) + ) # Field can_attach_attachment is automatically set self.assertTrue(composer_form.can_attach_attachment) @@ -63,13 +64,19 @@ class TestMailComposer(TransactionCase): """Test method _prepare_mail_values()""" attach2 = self.attach1.copy() # Create email composer with 2 Object Attachments - composer = self.env['mail.compose.message'].with_context({ - 'default_composition_mode': 'comment', - 'default_model': self.partner_01._name, - 'default_res_ids': self.partner_01.ids, - }).create({ - "object_attachment_ids": (self.attach1 + attach2).ids, - }) + composer = ( + self.env["mail.compose.message"] + .with_context( + default_composition_mode="comment", + default_model=self.partner_01._name, + default_res_ids=self.partner_01.ids, + ) + .create( + { + "object_attachment_ids": (self.attach1 + attach2).ids, + } + ) + ) # Two selectable Object Attachments are displayed display_records = composer.display_object_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 a1359663b..205893ff9 100644 --- a/mail_attach_existing_attachment/wizard/mail_compose_message.py +++ b/mail_attach_existing_attachment/wizard/mail_compose_message.py @@ -38,10 +38,12 @@ class MailComposeMessage(models.TransientModel): res_ids = self._evaluate_res_ids() model = self.model if model and res_ids: - attachments = self.env["ir.attachment"].search([ - ("res_model", "=", model), - ("res_id", "in", res_ids), - ]) + attachments = self.env["ir.attachment"].search( + [ + ("res_model", "=", model), + ("res_id", "in", res_ids), + ] + ) composer.display_object_attachment_ids = attachments else: composer.display_object_attachment_ids = False