mirror of https://github.com/OCA/social.git
[17.0][MIG] mail_attach_existing_attachment: pre-commit
parent
4f9792a782
commit
56addab119
|
@ -17,19 +17,20 @@ Mail Attach Existing Attachment
|
||||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||||
:alt: License: AGPL-3
|
:alt: License: AGPL-3
|
||||||
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github
|
.. |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
|
:alt: OCA/social
|
||||||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
|
.. |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
|
:alt: Translate me on Weblate
|
||||||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
|
.. |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
|
:alt: Try me on Runboat
|
||||||
|
|
||||||
|badge1| |badge2| |badge3| |badge4| |badge5|
|
|badge1| |badge2| |badge3| |badge4| |badge5|
|
||||||
|
|
||||||
This module was written to add the possibility to add attachments located on
|
This module was written to add the possibility to add attachments
|
||||||
the object by sending it by email with the mail compose message wizard
|
located on the object by sending it by email with the mail compose
|
||||||
|
message wizard
|
||||||
|
|
||||||
**Table of contents**
|
**Table of contents**
|
||||||
|
|
||||||
|
@ -41,20 +42,23 @@ Usage
|
||||||
|
|
||||||
To use this module, you need to:
|
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
|
|image1|
|
||||||
:alt: Attachment on purchase order
|
|
||||||
|
|
||||||
* 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
|
|image2|
|
||||||
:alt: Sends the Purchase Order by email
|
|
||||||
|
.. |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
|
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
|
Bug Tracker
|
||||||
===========
|
===========
|
||||||
|
@ -62,7 +66,7 @@ Bug Tracker
|
||||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
|
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
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
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
`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**>`_.
|
`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**>`_.
|
||||||
|
|
||||||
Do not contact contributors directly about support or help with technical issues.
|
Do not contact contributors directly about support or help with technical issues.
|
||||||
|
|
||||||
|
@ -70,23 +74,27 @@ Credits
|
||||||
=======
|
=======
|
||||||
|
|
||||||
Authors
|
Authors
|
||||||
~~~~~~~
|
-------
|
||||||
|
|
||||||
* ACSONE SA/NV
|
* ACSONE SA/NV
|
||||||
* Tecnativa
|
* Tecnativa
|
||||||
|
|
||||||
Contributors
|
Contributors
|
||||||
~~~~~~~~~~~~
|
------------
|
||||||
|
|
||||||
* Adrien Peiffer <adrien.peiffer@acsone.eu>
|
- Adrien Peiffer <adrien.peiffer@acsone.eu>
|
||||||
* Benoit Aimont <benoit.aimont@acsone.eu>
|
- Benoit Aimont <benoit.aimont@acsone.eu>
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
- `Tecnativa <https://www.tecnativa.com>`__:
|
||||||
|
|
||||||
* Sergio Teruel
|
- Sergio Teruel
|
||||||
* Ernesto Tejeda
|
- Ernesto Tejeda
|
||||||
|
|
||||||
|
- `360ERP <https://www.360erp.com>`__:
|
||||||
|
|
||||||
|
- Andrea Stirpe
|
||||||
|
|
||||||
Maintainers
|
Maintainers
|
||||||
~~~~~~~~~~~
|
-----------
|
||||||
|
|
||||||
This module is maintained by the OCA.
|
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
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.
|
promote its widespread use.
|
||||||
|
|
||||||
This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mail_attach_existing_attachment>`_ project on GitHub.
|
This module is part of the `OCA/social <https://github.com/OCA/social/tree/17.0/mail_attach_existing_attachment>`_ project on GitHub.
|
||||||
|
|
||||||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
[build-system]
|
||||||
|
requires = ["whool"]
|
||||||
|
build-backend = "whool.buildapi"
|
|
@ -0,0 +1,7 @@
|
||||||
|
- Adrien Peiffer \<<adrien.peiffer@acsone.eu>\>
|
||||||
|
- Benoit Aimont \<<benoit.aimont@acsone.eu>\>
|
||||||
|
- [Tecnativa](https://www.tecnativa.com):
|
||||||
|
- Sergio Teruel
|
||||||
|
- Ernesto Tejeda
|
||||||
|
- [360ERP](https://www.360erp.com):
|
||||||
|
- Andrea Stirpe
|
|
@ -1,10 +0,0 @@
|
||||||
* Adrien Peiffer <adrien.peiffer@acsone.eu>
|
|
||||||
* Benoit Aimont <benoit.aimont@acsone.eu>
|
|
||||||
* `Tecnativa <https://www.tecnativa.com>`_:
|
|
||||||
|
|
||||||
* Sergio Teruel
|
|
||||||
* Ernesto Tejeda
|
|
||||||
|
|
||||||
* `360ERP <https://www.360erp.com>`_:
|
|
||||||
|
|
||||||
* Andrea Stirpe
|
|
|
@ -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
|
|
@ -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
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
- The module only allows the addition of attachments linked to the
|
||||||
|
object.
|
|
@ -1 +0,0 @@
|
||||||
* The module only allows the addition of attachments linked to the object.
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
To use this module, you need to:
|
||||||
|
|
||||||
|
- Add some attachments on an object by creating a new *Log note*
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
- Then, by sending the object via email, you can select the attachment
|
||||||
|
added earlier
|
||||||
|
|
||||||
|

|
|
@ -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
|
|
|
@ -368,9 +368,10 @@ ul.auto-toc {
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
!! source digest: sha256:ac2a9aa40b0d4a582c625061abbe71035a0b6c6421af29465d20d9e51dcfbda3
|
!! source digest: sha256:ac2a9aa40b0d4a582c625061abbe71035a0b6c6421af29465d20d9e51dcfbda3
|
||||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||||
<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&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
<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&target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||||
<p>This module was written to add the possibility to add attachments located on
|
<p>This module was written to add the possibility to add attachments
|
||||||
the object by sending it by email with the mail compose message wizard</p>
|
located on the object by sending it by email with the mail compose
|
||||||
|
message wizard</p>
|
||||||
<p><strong>Table of contents</strong></p>
|
<p><strong>Table of contents</strong></p>
|
||||||
<div class="contents local topic" id="contents">
|
<div class="contents local topic" id="contents">
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
|
@ -391,20 +392,18 @@ the object by sending it by email with the mail compose message wizard</p>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Add some attachments on an object by creating a new <em>Log note</em></li>
|
<li>Add some attachments on an object by creating a new <em>Log note</em></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="figure">
|
<p><img alt="image1" src="https://raw.githubusercontent.com/OCA/social/17.0/mail_attach_existing_attachment/static/description/attachment.png" /></p>
|
||||||
<img alt="Attachment on purchase order" src="https://raw.githubusercontent.com/OCA/social/16.0/mail_attach_existing_attachment/static/description/attachment.png" />
|
|
||||||
</div>
|
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>Then, by sending the object via email, you can select the attachment added earlier</li>
|
<li>Then, by sending the object via email, you can select the attachment
|
||||||
|
added earlier</li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="figure">
|
<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>
|
||||||
<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" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="known-issues-roadmap">
|
<div class="section" id="known-issues-roadmap">
|
||||||
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
|
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
|
||||||
<ul class="simple">
|
<ul class="simple">
|
||||||
<li>The module only allows the addition of attachments linked to the object.</li>
|
<li>The module only allows the addition of attachments linked to the
|
||||||
|
object.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="bug-tracker">
|
<div class="section" id="bug-tracker">
|
||||||
|
@ -412,7 +411,7 @@ the object by sending it by email with the mail compose message wizard</p>
|
||||||
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/social/issues">GitHub Issues</a>.
|
||||||
In case of trouble, please check there if your issue has already been reported.
|
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
|
If you spotted it first, help us to smash it by providing a detailed and welcomed
|
||||||
<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>
|
<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>
|
||||||
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
<p>Do not contact contributors directly about support or help with technical issues.</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="credits">
|
<div class="section" id="credits">
|
||||||
|
@ -434,6 +433,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||||
<li>Ernesto Tejeda</li>
|
<li>Ernesto Tejeda</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
|
<li><a class="reference external" href="https://www.360erp.com">360ERP</a>:<ul>
|
||||||
|
<li>Andrea Stirpe</li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="section" id="maintainers">
|
<div class="section" id="maintainers">
|
||||||
|
@ -443,7 +446,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||||
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
<p>OCA, or the Odoo Community Association, is a nonprofit organization whose
|
||||||
mission is to support the collaborative development of Odoo features and
|
mission is to support the collaborative development of Odoo features and
|
||||||
promote its widespread use.</p>
|
promote its widespread use.</p>
|
||||||
<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>
|
<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>
|
||||||
<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>
|
<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>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,10 +6,9 @@ from odoo.tests.common import Form, TransactionCase
|
||||||
|
|
||||||
|
|
||||||
class TestMailComposer(TransactionCase):
|
class TestMailComposer(TransactionCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
super(TestMailComposer, cls).setUpClass()
|
super().setUpClass()
|
||||||
cls.partner_01 = cls.env["res.partner"].create(
|
cls.partner_01 = cls.env["res.partner"].create(
|
||||||
{
|
{
|
||||||
"name": "Partner 1",
|
"name": "Partner 1",
|
||||||
|
@ -30,11 +29,13 @@ class TestMailComposer(TransactionCase):
|
||||||
def test_01_send_email_attachment(self):
|
def test_01_send_email_attachment(self):
|
||||||
"""Test sending amail with attachment from Object Attachment of composer"""
|
"""Test sending amail with attachment from Object Attachment of composer"""
|
||||||
# Open email composer
|
# Open email composer
|
||||||
composer_form = Form(self.env['mail.compose.message'].with_context({
|
composer_form = Form(
|
||||||
'default_composition_mode': 'comment',
|
self.env["mail.compose.message"].with_context(
|
||||||
'default_model': self.partner_01._name,
|
default_composition_mode="comment",
|
||||||
'default_res_ids': self.partner_01.ids,
|
default_model=self.partner_01._name,
|
||||||
}))
|
default_res_ids=self.partner_01.ids,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# Field can_attach_attachment is automatically set
|
# Field can_attach_attachment is automatically set
|
||||||
self.assertTrue(composer_form.can_attach_attachment)
|
self.assertTrue(composer_form.can_attach_attachment)
|
||||||
|
@ -63,13 +64,19 @@ class TestMailComposer(TransactionCase):
|
||||||
"""Test method _prepare_mail_values()"""
|
"""Test method _prepare_mail_values()"""
|
||||||
attach2 = self.attach1.copy()
|
attach2 = self.attach1.copy()
|
||||||
# Create email composer with 2 Object Attachments
|
# Create email composer with 2 Object Attachments
|
||||||
composer = self.env['mail.compose.message'].with_context({
|
composer = (
|
||||||
'default_composition_mode': 'comment',
|
self.env["mail.compose.message"]
|
||||||
'default_model': self.partner_01._name,
|
.with_context(
|
||||||
'default_res_ids': self.partner_01.ids,
|
default_composition_mode="comment",
|
||||||
}).create({
|
default_model=self.partner_01._name,
|
||||||
|
default_res_ids=self.partner_01.ids,
|
||||||
|
)
|
||||||
|
.create(
|
||||||
|
{
|
||||||
"object_attachment_ids": (self.attach1 + attach2).ids,
|
"object_attachment_ids": (self.attach1 + attach2).ids,
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
# Two selectable Object Attachments are displayed
|
# Two selectable Object Attachments are displayed
|
||||||
display_records = composer.display_object_attachment_ids
|
display_records = composer.display_object_attachment_ids
|
||||||
|
|
|
@ -38,10 +38,12 @@ class MailComposeMessage(models.TransientModel):
|
||||||
res_ids = self._evaluate_res_ids()
|
res_ids = self._evaluate_res_ids()
|
||||||
model = self.model
|
model = self.model
|
||||||
if model and res_ids:
|
if model and res_ids:
|
||||||
attachments = self.env["ir.attachment"].search([
|
attachments = self.env["ir.attachment"].search(
|
||||||
|
[
|
||||||
("res_model", "=", model),
|
("res_model", "=", model),
|
||||||
("res_id", "in", res_ids),
|
("res_id", "in", res_ids),
|
||||||
])
|
]
|
||||||
|
)
|
||||||
composer.display_object_attachment_ids = attachments
|
composer.display_object_attachment_ids = attachments
|
||||||
else:
|
else:
|
||||||
composer.display_object_attachment_ids = False
|
composer.display_object_attachment_ids = False
|
||||||
|
|
Loading…
Reference in New Issue