odoo-addon-mail-attach-existing-attachment 16.0.1.0.1.7__py3-none-any.whl → 17.0.1.0.0.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. odoo/addons/mail_attach_existing_attachment/README.rst +31 -23
  2. odoo/addons/mail_attach_existing_attachment/__manifest__.py +1 -1
  3. odoo/addons/mail_attach_existing_attachment/i18n/mail_attach_existing_attachment.pot +6 -3
  4. odoo/addons/mail_attach_existing_attachment/readme/CONTRIBUTORS.md +7 -0
  5. odoo/addons/mail_attach_existing_attachment/readme/DESCRIPTION.md +3 -0
  6. odoo/addons/mail_attach_existing_attachment/readme/ROADMAP.md +2 -0
  7. odoo/addons/mail_attach_existing_attachment/readme/USAGE.md +10 -0
  8. odoo/addons/mail_attach_existing_attachment/static/description/index.html +17 -15
  9. odoo/addons/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py +72 -19
  10. odoo/addons/mail_attach_existing_attachment/wizard/mail_compose_message.py +24 -4
  11. odoo/addons/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml +8 -12
  12. {odoo_addon_mail_attach_existing_attachment-16.0.1.0.1.7.dist-info → odoo_addon_mail_attach_existing_attachment-17.0.1.0.0.3.dist-info}/METADATA +37 -32
  13. {odoo_addon_mail_attach_existing_attachment-16.0.1.0.1.7.dist-info → odoo_addon_mail_attach_existing_attachment-17.0.1.0.0.3.dist-info}/RECORD +15 -15
  14. {odoo_addon_mail_attach_existing_attachment-16.0.1.0.1.7.dist-info → odoo_addon_mail_attach_existing_attachment-17.0.1.0.0.3.dist-info}/WHEEL +1 -1
  15. odoo_addon_mail_attach_existing_attachment-17.0.1.0.0.3.dist-info/top_level.txt +1 -0
  16. odoo/addons/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst +0 -6
  17. odoo/addons/mail_attach_existing_attachment/readme/DESCRIPTION.rst +0 -2
  18. odoo/addons/mail_attach_existing_attachment/readme/ROADMAP.rst +0 -1
  19. odoo/addons/mail_attach_existing_attachment/readme/USAGE.rst +0 -11
  20. odoo_addon_mail_attach_existing_attachment-16.0.1.0.1.7.dist-info/top_level.txt +0 -1
@@ -7,7 +7,7 @@ Mail Attach Existing Attachment
7
7
  !! This file is generated by oca-gen-addon-readme !!
8
8
  !! changes will be overwritten. !!
9
9
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10
- !! source digest: sha256:abc6af897ab2e0f7898e5b9fc07671e0bb96c1fb8ffcee09980a3173537b6318
10
+ !! source digest: sha256:06897e29cf4f22512f7b26e538e7883ef789bd3f99a6c2666c3f6fce2ac51427
11
11
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12
12
 
13
13
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -17,19 +17,20 @@ Mail Attach Existing Attachment
17
17
  :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18
18
  :alt: License: AGPL-3
19
19
  .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
20
- :target: https://github.com/OCA/social/tree/16.0/mail_attach_existing_attachment
20
+ :target: https://github.com/OCA/social/tree/17.0/mail_attach_existing_attachment
21
21
  :alt: OCA/social
22
22
  .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23
- :target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_attach_existing_attachment
23
+ :target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_attach_existing_attachment
24
24
  :alt: Translate me on Weblate
25
25
  .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26
- :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0
26
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
27
27
  :alt: Try me on Runboat
28
28
 
29
29
  |badge1| |badge2| |badge3| |badge4| |badge5|
30
30
 
31
- This module was written to add the possibility to add attachments located on
32
- the object by sending it by email with the mail compose message wizard
31
+ This module was written to add the possibility to add attachments
32
+ located on the object by sending it by email with the mail compose
33
+ message wizard
33
34
 
34
35
  **Table of contents**
35
36
 
@@ -41,20 +42,23 @@ Usage
41
42
 
42
43
  To use this module, you need to:
43
44
 
44
- * Add some attachments on an object by creating a new *Log note*
45
+ - Add some attachments on an object by creating a new *Log note*
45
46
 
46
- .. figure:: https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/attachment.png
47
- :alt: Attachment on purchase order
47
+ |image1|
48
48
 
49
- * Then, by sending the object via email, you can select the attachment added earlier
49
+ - Then, by sending the object via email, you can select the attachment
50
+ added earlier
50
51
 
51
- .. figure:: https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png
52
- :alt: Sends the Purchase Order by email
52
+ |image2|
53
+
54
+ .. |image1| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/attachment.png
55
+ .. |image2| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png
53
56
 
54
57
  Known issues / Roadmap
55
58
  ======================
56
59
 
57
- * The module only allows the addition of attachments linked to the object.
60
+ - The module only allows the addition of attachments linked to the
61
+ object.
58
62
 
59
63
  Bug Tracker
60
64
  ===========
@@ -62,7 +66,7 @@ Bug Tracker
62
66
  Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
63
67
  In case of trouble, please check there if your issue has already been reported.
64
68
  If you spotted it first, help us to smash it by providing a detailed and welcomed
65
- `feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_attach_existing_attachment%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
69
+ `feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_attach_existing_attachment%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
66
70
 
67
71
  Do not contact contributors directly about support or help with technical issues.
68
72
 
@@ -70,23 +74,27 @@ Credits
70
74
  =======
71
75
 
72
76
  Authors
73
- ~~~~~~~
77
+ -------
74
78
 
75
79
  * ACSONE SA/NV
76
80
  * Tecnativa
77
81
 
78
82
  Contributors
79
- ~~~~~~~~~~~~
83
+ ------------
84
+
85
+ - Adrien Peiffer <adrien.peiffer@acsone.eu>
86
+ - Benoit Aimont <benoit.aimont@acsone.eu>
87
+ - `Tecnativa <https://www.tecnativa.com>`__:
88
+
89
+ - Sergio Teruel
90
+ - Ernesto Tejeda
80
91
 
81
- * Adrien Peiffer <adrien.peiffer@acsone.eu>
82
- * Benoit Aimont <benoit.aimont@acsone.eu>
83
- * `Tecnativa <https://www.tecnativa.com>`_:
92
+ - `360ERP <https://www.360erp.com>`__:
84
93
 
85
- * Sergio Teruel
86
- * Ernesto Tejeda
94
+ - Andrea Stirpe
87
95
 
88
96
  Maintainers
89
- ~~~~~~~~~~~
97
+ -----------
90
98
 
91
99
  This module is maintained by the OCA.
92
100
 
@@ -98,6 +106,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
98
106
  mission is to support the collaborative development of Odoo features and
99
107
  promote its widespread use.
100
108
 
101
- This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mail_attach_existing_attachment>`_ project on GitHub.
109
+ This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/mail_attach_existing_attachment>`_ project on GitHub.
102
110
 
103
111
  You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
@@ -7,7 +7,7 @@
7
7
  "author": "ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)",
8
8
  "website": "https://github.com/OCA/social",
9
9
  "category": "Social Network",
10
- "version": "16.0.1.0.1",
10
+ "version": "17.0.1.0.0",
11
11
  "license": "AGPL-3",
12
12
  "depends": ["mail"],
13
13
  "data": ["wizard/mail_compose_message_view.xml"],
@@ -4,7 +4,7 @@
4
4
  #
5
5
  msgid ""
6
6
  msgstr ""
7
- "Project-Id-Version: Odoo Server 16.0\n"
7
+ "Project-Id-Version: Odoo Server 17.0\n"
8
8
  "Report-Msgid-Bugs-To: \n"
9
9
  "Last-Translator: \n"
10
10
  "Language-Team: \n"
@@ -14,18 +14,21 @@ msgstr ""
14
14
  "Plural-Forms: \n"
15
15
 
16
16
  #. module: mail_attach_existing_attachment
17
- #: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_account_invoice_send__can_attach_attachment
18
17
  #: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__can_attach_attachment
19
18
  msgid "Can Attach Attachment"
20
19
  msgstr ""
21
20
 
21
+ #. module: mail_attach_existing_attachment
22
+ #: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__display_object_attachment_ids
23
+ msgid "Display Object Attachment"
24
+ msgstr ""
25
+
22
26
  #. module: mail_attach_existing_attachment
23
27
  #: model:ir.model,name:mail_attach_existing_attachment.model_mail_compose_message
24
28
  msgid "Email composition wizard"
25
29
  msgstr ""
26
30
 
27
31
  #. module: mail_attach_existing_attachment
28
- #: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_account_invoice_send__object_attachment_ids
29
32
  #: model:ir.model.fields,field_description:mail_attach_existing_attachment.field_mail_compose_message__object_attachment_ids
30
33
  msgid "Object Attachments"
31
34
  msgstr ""
@@ -0,0 +1,7 @@
1
+ - Adrien Peiffer \<<adrien.peiffer@acsone.eu>\>
2
+ - Benoit Aimont \<<benoit.aimont@acsone.eu>\>
3
+ - [Tecnativa](https://www.tecnativa.com):
4
+ - Sergio Teruel
5
+ - Ernesto Tejeda
6
+ - [360ERP](https://www.360erp.com):
7
+ - Andrea Stirpe
@@ -0,0 +1,3 @@
1
+ This module was written to add the possibility to add attachments
2
+ located on the object by sending it by email with the mail compose
3
+ message wizard
@@ -0,0 +1,2 @@
1
+ - The module only allows the addition of attachments linked to the
2
+ object.
@@ -0,0 +1,10 @@
1
+ To use this module, you need to:
2
+
3
+ - Add some attachments on an object by creating a new *Log note*
4
+
5
+ ![](../static/description/attachment.png)
6
+
7
+ - Then, by sending the object via email, you can select the attachment
8
+ added earlier
9
+
10
+ ![](../static/description/ex_mail_compose_message.png)
@@ -1,4 +1,3 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
1
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
2
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
3
  <head>
@@ -367,11 +366,12 @@ ul.auto-toc {
367
366
  !! This file is generated by oca-gen-addon-readme !!
368
367
  !! changes will be overwritten. !!
369
368
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
370
- !! source digest: sha256:abc6af897ab2e0f7898e5b9fc07671e0bb96c1fb8ffcee09980a3173537b6318
369
+ !! source digest: sha256:06897e29cf4f22512f7b26e538e7883ef789bd3f99a6c2666c3f6fce2ac51427
371
370
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
372
- <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/16.0/mail_attach_existing_attachment"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_attach_existing_attachment"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
373
- <p>This module was written to add the possibility to add attachments located on
374
- the object by sending it by email with the mail compose message wizard</p>
371
+ <p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/social/tree/17.0/mail_attach_existing_attachment"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_attach_existing_attachment"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/social&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
372
+ <p>This module was written to add the possibility to add attachments
373
+ located on the object by sending it by email with the mail compose
374
+ message wizard</p>
375
375
  <p><strong>Table of contents</strong></p>
376
376
  <div class="contents local topic" id="contents">
377
377
  <ul class="simple">
@@ -392,20 +392,18 @@ the object by sending it by email with the mail compose message wizard</p>
392
392
  <ul class="simple">
393
393
  <li>Add some attachments on an object by creating a new <em>Log note</em></li>
394
394
  </ul>
395
- <div class="figure">
396
- <img alt="Attachment on purchase order" src="https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/attachment.png" />
397
- </div>
395
+ <p><img alt="image1" src="https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/attachment.png" /></p>
398
396
  <ul class="simple">
399
- <li>Then, by sending the object via email, you can select the attachment added earlier</li>
397
+ <li>Then, by sending the object via email, you can select the attachment
398
+ added earlier</li>
400
399
  </ul>
401
- <div class="figure">
402
- <img alt="Sends the Purchase Order by email" src="https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png" />
403
- </div>
400
+ <p><img alt="image2" src="https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png" /></p>
404
401
  </div>
405
402
  <div class="section" id="known-issues-roadmap">
406
403
  <h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
407
404
  <ul class="simple">
408
- <li>The module only allows the addition of attachments linked to the object.</li>
405
+ <li>The module only allows the addition of attachments linked to the
406
+ object.</li>
409
407
  </ul>
410
408
  </div>
411
409
  <div class="section" id="bug-tracker">
@@ -413,7 +411,7 @@ the object by sending it by email with the mail compose message wizard</p>
413
411
  <p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
414
412
  In case of trouble, please check there if your issue has already been reported.
415
413
  If you spotted it first, help us to smash it by providing a detailed and welcomed
416
- <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_attach_existing_attachment%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
414
+ <a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_attach_existing_attachment%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
417
415
  <p>Do not contact contributors directly about support or help with technical issues.</p>
418
416
  </div>
419
417
  <div class="section" id="credits">
@@ -435,6 +433,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
435
433
  <li>Ernesto Tejeda</li>
436
434
  </ul>
437
435
  </li>
436
+ <li><a class="reference external" href="https://www.360erp.com">360ERP</a>:<ul>
437
+ <li>Andrea Stirpe</li>
438
+ </ul>
439
+ </li>
438
440
  </ul>
439
441
  </div>
440
442
  <div class="section" id="maintainers">
@@ -444,7 +446,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
444
446
  <p>OCA, or the Odoo Community Association, is a nonprofit organization whose
445
447
  mission is to support the collaborative development of Odoo features and
446
448
  promote its widespread use.</p>
447
- <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/16.0/mail_attach_existing_attachment">OCA/social</a> project on GitHub.</p>
449
+ <p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/17.0/mail_attach_existing_attachment">OCA/social</a> project on GitHub.</p>
448
450
  <p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
449
451
  </div>
450
452
  </div>
@@ -1,14 +1,15 @@
1
1
  # Copyright 2015 ACSONE SA/NV
2
+ # Copyright 2024 360ERP (<https://www.360erp.com>)
2
3
  # License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3
4
 
4
- from odoo.tests import common
5
+ from odoo.tests.common import Form, TransactionCase
5
6
 
6
7
 
7
- class TestAttachExistingAttachment(common.TransactionCase):
8
- def setUp(self):
9
- super().setUp()
10
- self.partner_obj = self.env["res.partner"]
11
- self.partner_01 = self.env["res.partner"].create(
8
+ class TestMailComposer(TransactionCase):
9
+ @classmethod
10
+ def setUpClass(cls):
11
+ super().setUpClass()
12
+ cls.partner_01 = cls.env["res.partner"].create(
12
13
  {
13
14
  "name": "Partner 1",
14
15
  "email": "partner1@example.org",
@@ -16,22 +17,74 @@ class TestAttachExistingAttachment(common.TransactionCase):
16
17
  "parent_id": False,
17
18
  }
18
19
  )
19
-
20
- def test_send_email_attachment(self):
21
- attach1 = self.env["ir.attachment"].create(
20
+ cls.attach1 = cls.env["ir.attachment"].create(
22
21
  {
23
22
  "name": "Attach1",
24
23
  "datas": "bWlncmF0aW9uIHRlc3Q=",
25
24
  "res_model": "res.partner",
26
- "res_id": self.partner_01.id,
25
+ "res_id": cls.partner_01.id,
27
26
  }
28
27
  )
29
- vals = {
30
- "model": "res.partner",
31
- "partner_ids": [(6, 0, [self.partner_01.id])],
32
- "res_id": self.partner_01.id,
33
- "object_attachment_ids": [(6, 0, [attach1.id])],
34
- }
35
- mail = self.env["mail.compose.message"].create(vals)
36
- values = mail.get_mail_values([self.partner_01.id])
37
- self.assertTrue(attach1.id in values[self.partner_01.id]["attachment_ids"])
28
+
29
+ def test_01_send_email_attachment(self):
30
+ """Test sending amail with attachment from Object Attachment of composer"""
31
+ # Open email composer
32
+ composer_form = Form(
33
+ self.env["mail.compose.message"].with_context(
34
+ default_composition_mode="comment",
35
+ default_model=self.partner_01._name,
36
+ default_res_ids=self.partner_01.ids,
37
+ )
38
+ )
39
+
40
+ # Field can_attach_attachment is automatically set
41
+ self.assertTrue(composer_form.can_attach_attachment)
42
+
43
+ # By default, no attachments are present
44
+ self.assertFalse(composer_form.partner_ids[:])
45
+ self.assertEqual(len(composer_form.attachment_ids), 0)
46
+ self.assertEqual(len(composer_form.object_attachment_ids), 0)
47
+
48
+ # One selectable Object Attachment is displayed
49
+ display_records = composer_form.display_object_attachment_ids._records
50
+ self.assertEqual(len(display_records), 1)
51
+ self.assertEqual(display_records[0]["id"], self.attach1.id)
52
+
53
+ # Fill email composer with the Object Attachment
54
+ composer_form.partner_ids = self.partner_01
55
+ composer_form.object_attachment_ids = self.attach1
56
+ mail = composer_form.save()
57
+
58
+ # Send email: the attachment is sent
59
+ values = mail._action_send_mail()
60
+ result_message = values[1]
61
+ self.assertEqual(result_message.attachment_ids, self.attach1)
62
+
63
+ def test_02_prepare_mail_values(self):
64
+ """Test method _prepare_mail_values()"""
65
+ attach2 = self.attach1.copy()
66
+ # Create email composer with 2 Object Attachments
67
+ composer = (
68
+ self.env["mail.compose.message"]
69
+ .with_context(
70
+ default_composition_mode="comment",
71
+ default_model=self.partner_01._name,
72
+ default_res_ids=self.partner_01.ids,
73
+ )
74
+ .create(
75
+ {
76
+ "object_attachment_ids": (self.attach1 + attach2).ids,
77
+ }
78
+ )
79
+ )
80
+
81
+ # Two selectable Object Attachments are displayed
82
+ display_records = composer.display_object_attachment_ids
83
+ self.assertEqual(len(display_records), 2)
84
+ self.assertIn(self.attach1, display_records)
85
+ self.assertIn(attach2, display_records)
86
+
87
+ # Invoking _prepare_mail_values(): both attachment_ids are set
88
+ values = composer._prepare_mail_values(self.partner_01.ids)
89
+ self.assertIn(self.attach1.id, values[self.partner_01.id]["attachment_ids"])
90
+ self.assertIn(attach2.id, values[self.partner_01.id]["attachment_ids"])
@@ -11,10 +11,10 @@ class MailComposeMessage(models.TransientModel):
11
11
  def default_get(self, fields_list):
12
12
  res = super().default_get(fields_list)
13
13
  if (
14
- res.get("res_id")
14
+ "can_attach_attachment" not in res
15
15
  and res.get("model")
16
+ and res.get("res_ids")
16
17
  and res.get("composition_mode", "") != "mass_mail"
17
- and not res.get("can_attach_attachment")
18
18
  ):
19
19
  res["can_attach_attachment"] = True # pragma: no cover
20
20
  return res
@@ -27,9 +27,29 @@ class MailComposeMessage(models.TransientModel):
27
27
  column2="attachment_id",
28
28
  string="Object Attachments",
29
29
  )
30
+ display_object_attachment_ids = fields.One2many(
31
+ comodel_name="ir.attachment",
32
+ compute="_compute_display_object_attachment_ids",
33
+ )
34
+
35
+ @api.depends("res_ids", "model")
36
+ def _compute_display_object_attachment_ids(self):
37
+ for composer in self:
38
+ res_ids = self._evaluate_res_ids()
39
+ model = self.model
40
+ if model and res_ids:
41
+ attachments = self.env["ir.attachment"].search(
42
+ [
43
+ ("res_model", "=", model),
44
+ ("res_id", "in", res_ids),
45
+ ]
46
+ )
47
+ composer.display_object_attachment_ids = attachments
48
+ else:
49
+ composer.display_object_attachment_ids = False
30
50
 
31
- def get_mail_values(self, res_ids):
32
- res = super().get_mail_values(res_ids)
51
+ def _prepare_mail_values(self, res_ids):
52
+ res = super()._prepare_mail_values(res_ids)
33
53
  if self.object_attachment_ids.ids and self.model and len(res_ids) == 1:
34
54
  res[res_ids[0]].setdefault("attachment_ids", []).extend(
35
55
  self.object_attachment_ids.ids
@@ -1,22 +1,18 @@
1
1
  <?xml version="1.0" encoding="utf-8" ?>
2
2
  <odoo>
3
- <record model="ir.ui.view" id="email_compose_message_wizard_inherit_form">
4
- <field
5
- name="name"
6
- >mail.compose.message.form (mail_attach_existing_attachment)</field>
3
+ <record id="email_compose_message_wizard_inherit_form" model="ir.ui.view">
7
4
  <field name="model">mail.compose.message</field>
8
5
  <field name="inherit_id" ref="mail.email_compose_message_wizard_form" />
9
6
  <field name="arch" type="xml">
10
7
  <xpath expr="//field[@name='attachment_ids']" position="after">
11
8
  <field name="can_attach_attachment" invisible="1" />
12
- <div attrs="{'invisible': [('can_attach_attachment', '=', False)]}">
13
- <br />
14
- <field
15
- name="object_attachment_ids"
16
- widget="many2many_checkboxes"
17
- domain="[('res_model', '=', model), ('res_id', '=', res_id)]"
18
- />
19
- </div>
9
+ <field name="display_object_attachment_ids" invisible="1" />
10
+ <field
11
+ name="object_attachment_ids"
12
+ widget="many2many_checkboxes"
13
+ domain="[('id', 'in', display_object_attachment_ids)]"
14
+ invisible="not can_attach_attachment"
15
+ />
20
16
  </xpath>
21
17
  </field>
22
18
  </record>
@@ -1,18 +1,17 @@
1
1
  Metadata-Version: 2.1
2
- Name: odoo-addon-mail-attach-existing-attachment
3
- Version: 16.0.1.0.1.7
2
+ Name: odoo-addon-mail_attach_existing_attachment
3
+ Version: 17.0.1.0.0.3
4
+ Requires-Python: >=3.10
5
+ Requires-Dist: odoo>=17.0a,<17.1dev
4
6
  Summary: Adding attachment on the object by sending this one
5
7
  Home-page: https://github.com/OCA/social
8
+ License: AGPL-3
6
9
  Author: ACSONE SA/NV, Tecnativa, Odoo Community Association (OCA)
7
10
  Author-email: support@odoo-community.org
8
- License: AGPL-3
9
- Platform: UNKNOWN
10
11
  Classifier: Programming Language :: Python
11
12
  Classifier: Framework :: Odoo
12
- Classifier: Framework :: Odoo :: 16.0
13
+ Classifier: Framework :: Odoo :: 17.0
13
14
  Classifier: License :: OSI Approved :: GNU Affero General Public License v3
14
- Requires-Python: >=3.10
15
- Requires-Dist: odoo <16.1dev,>=16.0a
16
15
 
17
16
  ===============================
18
17
  Mail Attach Existing Attachment
@@ -23,7 +22,7 @@ Mail Attach Existing Attachment
23
22
  !! This file is generated by oca-gen-addon-readme !!
24
23
  !! changes will be overwritten. !!
25
24
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
26
- !! source digest: sha256:abc6af897ab2e0f7898e5b9fc07671e0bb96c1fb8ffcee09980a3173537b6318
25
+ !! source digest: sha256:06897e29cf4f22512f7b26e538e7883ef789bd3f99a6c2666c3f6fce2ac51427
27
26
  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28
27
 
29
28
  .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
@@ -33,19 +32,20 @@ Mail Attach Existing Attachment
33
32
  :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
34
33
  :alt: License: AGPL-3
35
34
  .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
36
- :target: https://github.com/OCA/social/tree/16.0/mail_attach_existing_attachment
35
+ :target: https://github.com/OCA/social/tree/17.0/mail_attach_existing_attachment
37
36
  :alt: OCA/social
38
37
  .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
39
- :target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_attach_existing_attachment
38
+ :target: https://translation.odoo-community.org/projects/social-17-0/social-17-0-mail_attach_existing_attachment
40
39
  :alt: Translate me on Weblate
41
40
  .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
42
- :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=16.0
41
+ :target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
43
42
  :alt: Try me on Runboat
44
43
 
45
44
  |badge1| |badge2| |badge3| |badge4| |badge5|
46
45
 
47
- This module was written to add the possibility to add attachments located on
48
- the object by sending it by email with the mail compose message wizard
46
+ This module was written to add the possibility to add attachments
47
+ located on the object by sending it by email with the mail compose
48
+ message wizard
49
49
 
50
50
  **Table of contents**
51
51
 
@@ -57,20 +57,23 @@ Usage
57
57
 
58
58
  To use this module, you need to:
59
59
 
60
- * Add some attachments on an object by creating a new *Log note*
60
+ - Add some attachments on an object by creating a new *Log note*
61
+
62
+ |image1|
61
63
 
62
- .. figure:: https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/attachment.png
63
- :alt: Attachment on purchase order
64
+ - Then, by sending the object via email, you can select the attachment
65
+ added earlier
64
66
 
65
- * Then, by sending the object via email, you can select the attachment added earlier
67
+ |image2|
66
68
 
67
- .. figure:: https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png
68
- :alt: Sends the Purchase Order by email
69
+ .. |image1| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/attachment.png
70
+ .. |image2| image:: https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png
69
71
 
70
72
  Known issues / Roadmap
71
73
  ======================
72
74
 
73
- * The module only allows the addition of attachments linked to the object.
75
+ - The module only allows the addition of attachments linked to the
76
+ object.
74
77
 
75
78
  Bug Tracker
76
79
  ===========
@@ -78,7 +81,7 @@ Bug Tracker
78
81
  Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
79
82
  In case of trouble, please check there if your issue has already been reported.
80
83
  If you spotted it first, help us to smash it by providing a detailed and welcomed
81
- `feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_attach_existing_attachment%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
84
+ `feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_attach_existing_attachment%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
82
85
 
83
86
  Do not contact contributors directly about support or help with technical issues.
84
87
 
@@ -86,23 +89,27 @@ Credits
86
89
  =======
87
90
 
88
91
  Authors
89
- ~~~~~~~
92
+ -------
90
93
 
91
94
  * ACSONE SA/NV
92
95
  * Tecnativa
93
96
 
94
97
  Contributors
95
- ~~~~~~~~~~~~
98
+ ------------
96
99
 
97
- * Adrien Peiffer <adrien.peiffer@acsone.eu>
98
- * Benoit Aimont <benoit.aimont@acsone.eu>
99
- * `Tecnativa <https://www.tecnativa.com>`_:
100
+ - Adrien Peiffer <adrien.peiffer@acsone.eu>
101
+ - Benoit Aimont <benoit.aimont@acsone.eu>
102
+ - `Tecnativa <https://www.tecnativa.com>`__:
100
103
 
101
- * Sergio Teruel
102
- * Ernesto Tejeda
104
+ - Sergio Teruel
105
+ - Ernesto Tejeda
106
+
107
+ - `360ERP <https://www.360erp.com>`__:
108
+
109
+ - Andrea Stirpe
103
110
 
104
111
  Maintainers
105
- ~~~~~~~~~~~
112
+ -----------
106
113
 
107
114
  This module is maintained by the OCA.
108
115
 
@@ -114,8 +121,6 @@ OCA, or the Odoo Community Association, is a nonprofit organization whose
114
121
  mission is to support the collaborative development of Odoo features and
115
122
  promote its widespread use.
116
123
 
117
- This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mail_attach_existing_attachment>`_ project on GitHub.
124
+ This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/mail_attach_existing_attachment>`_ project on GitHub.
118
125
 
119
126
  You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
120
-
121
-
@@ -1,6 +1,6 @@
1
- odoo/addons/mail_attach_existing_attachment/README.rst,sha256=uVs8MVmHwp0vnU2irFStEc6u4Ilmiu_leh2NRyaotBc,3768
1
+ odoo/addons/mail_attach_existing_attachment/README.rst,sha256=X_9cLgaa5BRaOo74C-sVxa0etSjRcGlwWrB3stcuq7g,3801
2
2
  odoo/addons/mail_attach_existing_attachment/__init__.py,sha256=jI5PZDKS0aV-yXubn1o0DHe5ldzQZrLmZYbgF0Q7DWg,21
3
- odoo/addons/mail_attach_existing_attachment/__manifest__.py,sha256=1k7xXb-woTE2XbLZYEdWF5vyrepseLMwh4Eyo2UC26w,532
3
+ odoo/addons/mail_attach_existing_attachment/__manifest__.py,sha256=QdEhFE95u59v5gR6-_1pfRm5HyVK1pMyKVRWc10CFTI,532
4
4
  odoo/addons/mail_attach_existing_attachment/i18n/ca.po,sha256=FvrnIE5py7cB7n0z7BgljwICPbQHz-unFnUXClcPc8Y,1476
5
5
  odoo/addons/mail_attach_existing_attachment/i18n/de.po,sha256=q_bUEBpsnQjv6XToUXSo2tesodUhJuQcTpCGkM8KdWQ,1617
6
6
  odoo/addons/mail_attach_existing_attachment/i18n/es.po,sha256=09YFr5q_xGqWIxbLiA2yV_cosLJiQQJzJ1y6JbfOZ3E,1671
@@ -9,24 +9,24 @@ odoo/addons/mail_attach_existing_attachment/i18n/fr.po,sha256=sI2Gf_nxP30vRrnni9
9
9
  odoo/addons/mail_attach_existing_attachment/i18n/he.po,sha256=Rfy-HKSfYVtwfFgtnL0qkywwpGe8xEdddgDKVHakT5I,1547
10
10
  odoo/addons/mail_attach_existing_attachment/i18n/hr.po,sha256=hx8kPK5h4FqB684JlehLukWdZguMStRFUh8gpvOAHnI,1629
11
11
  odoo/addons/mail_attach_existing_attachment/i18n/it.po,sha256=IS6QrBz65lq9EvYZb3zL68La1LYjpNcwWX3Y-LxiHNA,1657
12
- odoo/addons/mail_attach_existing_attachment/i18n/mail_attach_existing_attachment.pot,sha256=tMsa2VmMHejskAVIF75HQjpS1YBFOWwRZm_Kw-WhRj0,1212
12
+ odoo/addons/mail_attach_existing_attachment/i18n/mail_attach_existing_attachment.pot,sha256=o6-4GJdW17PxygB9njB41iRrWDtorXEz6r0LtCJ0NlU,1183
13
13
  odoo/addons/mail_attach_existing_attachment/i18n/pt_BR.po,sha256=hb0--nb4INP_5Q-2Mj4wpiqRRmQlNdRHyJ_0u7CyNQU,1639
14
14
  odoo/addons/mail_attach_existing_attachment/i18n/sl.po,sha256=GyHj5rB0rCHj_HaHVFg8TBPpC8i0B8ZTdNtAyAFMJyw,1663
15
15
  odoo/addons/mail_attach_existing_attachment/i18n/zh_CN.po,sha256=jETydh_3GDOxCWBdUFpgAWw-njCHLRgsCyOcokEP8YY,1524
16
- odoo/addons/mail_attach_existing_attachment/readme/CONTRIBUTORS.rst,sha256=48_3n5KNN7FtjBAIeZfu55RKgKn59bJc2kDLwiBbjmc,168
17
- odoo/addons/mail_attach_existing_attachment/readme/DESCRIPTION.rst,sha256=p4pwhXyJ7mfBC618E5bU3ckiAGCBOIiUvMrtNrX2YqQ,148
18
- odoo/addons/mail_attach_existing_attachment/readme/ROADMAP.rst,sha256=x74BJfL-OCikUS2hiwka297CoBxeWmF1RklSaY_L7xQ,75
19
- odoo/addons/mail_attach_existing_attachment/readme/USAGE.rst,sha256=S4_ydm0S7rJ5uGUZcx3QAenzC1id8letQAuF8UHEDh0,379
16
+ odoo/addons/mail_attach_existing_attachment/readme/CONTRIBUTORS.md,sha256=VGU8roRk0BLkhKKgrSTXe4skSKlUNSjUdsPvsWqenZ0,227
17
+ odoo/addons/mail_attach_existing_attachment/readme/DESCRIPTION.md,sha256=ELxHGwZmpV4mq5GK4rZ9LZOBiWOGAh2il2ZqjqZG9FE,148
18
+ odoo/addons/mail_attach_existing_attachment/readme/ROADMAP.md,sha256=mtu-iXNw38izjj-v1jqoUn9AgQUy3_oQiQF9nj6V0F8,77
19
+ odoo/addons/mail_attach_existing_attachment/readme/USAGE.md,sha256=GuOMejtbw1qr3RMFifW9y9OBh7V8mj27GQ1NyZXxbfc,286
20
20
  odoo/addons/mail_attach_existing_attachment/static/description/attachment.png,sha256=uCMfLP6qpYwhuaxipL9GRiXloI_BHU6b2hQhtOJJ77M,15404
21
21
  odoo/addons/mail_attach_existing_attachment/static/description/ex_mail_compose_message.png,sha256=-QFEgk_bZmWlrLa_fLHcF8vMlWLlUi1f6KPWYOWB9YY,51219
22
22
  odoo/addons/mail_attach_existing_attachment/static/description/icon.png,sha256=0a5zV5ax5e7WQ2u5HtHlIrysylOYa3TNBgabf6Hq-pU,4773
23
- odoo/addons/mail_attach_existing_attachment/static/description/index.html,sha256=vsoj7GwtJbevt7aUZjPLvNKJq4y-IAKa_f-DvQ7p4iM,13730
23
+ odoo/addons/mail_attach_existing_attachment/static/description/index.html,sha256=Gczjk6LfZD9C1RU9zrIWNlmXjbzwBylPL1Nm1COjV6w,13715
24
24
  odoo/addons/mail_attach_existing_attachment/tests/__init__.py,sha256=xLDKxpu7_OUqUm3DdhekPq9GlvwVJSwhWdwkvUakRLw,51
25
- odoo/addons/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py,sha256=hWz2-ZA9T8j80OEC596jEeq7LHrF48cNoGflwsqd_Ug,1275
25
+ odoo/addons/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py,sha256=6J_ocisfPupZLhmsT1ihrWelZ_nC1sHFB3-PCR52icY,3463
26
26
  odoo/addons/mail_attach_existing_attachment/wizard/__init__.py,sha256=BLSMcf_t3X_KJsiQOH2zfDmR84QYqg7h3lLEES7sItk,35
27
- odoo/addons/mail_attach_existing_attachment/wizard/mail_compose_message.py,sha256=EvmVN2bV_hH-M3Ef1O7UInAnYd7LOuw5plVY_rhnNHo,1234
28
- odoo/addons/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml,sha256=nffpZw56czvAtEKpzTYxOQgsP7GKzNFJPU93oiKnZz0,1002
29
- odoo_addon_mail_attach_existing_attachment-16.0.1.0.1.7.dist-info/METADATA,sha256=6GojH2urcffx7sBAF4x-5bxAon44TSIhFYwuihTxKOU,4355
30
- odoo_addon_mail_attach_existing_attachment-16.0.1.0.1.7.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
31
- odoo_addon_mail_attach_existing_attachment-16.0.1.0.1.7.dist-info/top_level.txt,sha256=qBj40grFkGOfDZ2WDSw3y1RnDlgG0u8rP8pvGNdbz4w,5
32
- odoo_addon_mail_attach_existing_attachment-16.0.1.0.1.7.dist-info/RECORD,,
27
+ odoo/addons/mail_attach_existing_attachment/wizard/mail_compose_message.py,sha256=kBair1KsTbOveDsVLeemgRi8NGosf-hMJ7Bxle4e7n8,2010
28
+ odoo/addons/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml,sha256=S9ZfHTLB0jeEGfEbK6xQaqzNDNUXJixQYigwb_eYXyM,859
29
+ odoo_addon_mail_attach_existing_attachment-17.0.1.0.0.3.dist-info/METADATA,sha256=Lu77BntDH7ogDG0BB1I4bvTKxZbqm5MFYcmZBEHoMyo,4367
30
+ odoo_addon_mail_attach_existing_attachment-17.0.1.0.0.3.dist-info/WHEEL,sha256=8Rd4enx1PCuyDWP4SABqO5Fv8rpaknqp3VzjoFFLa6c,83
31
+ odoo_addon_mail_attach_existing_attachment-17.0.1.0.0.3.dist-info/top_level.txt,sha256=QE6RBQ0QX5f4eFuUcGgU5Kbq1A_qJcDs-e_vpr6pmfU,4
32
+ odoo_addon_mail_attach_existing_attachment-17.0.1.0.0.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.41.2)
2
+ Generator: Whool 1.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,6 +0,0 @@
1
- * Adrien Peiffer <adrien.peiffer@acsone.eu>
2
- * Benoit Aimont <benoit.aimont@acsone.eu>
3
- * `Tecnativa <https://www.tecnativa.com>`_:
4
-
5
- * Sergio Teruel
6
- * Ernesto Tejeda
@@ -1,2 +0,0 @@
1
- This module was written to add the possibility to add attachments located on
2
- the object by sending it by email with the mail compose message wizard
@@ -1 +0,0 @@
1
- * The module only allows the addition of attachments linked to the object.
@@ -1,11 +0,0 @@
1
- To use this module, you need to:
2
-
3
- * Add some attachments on an object by creating a new *Log note*
4
-
5
- .. figure:: ../static/description/attachment.png
6
- :alt: Attachment on purchase order
7
-
8
- * Then, by sending the object via email, you can select the attachment added earlier
9
-
10
- .. figure:: ../static/description/ex_mail_compose_message.png
11
- :alt: Sends the Purchase Order by email