Skip to content

Commit

Permalink
[16.0][MIG] mail_layout_force: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Abranes committed Nov 2, 2023
1 parent cefb2c7 commit 9e6d483
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 20 deletions.
15 changes: 8 additions & 7 deletions mail_layout_force/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Mail Layout Force
: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/15.0/mail_layout_force
:target: https://github.com/OCA/social/tree/16.0/mail_layout_force
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_layout_force
:target: https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_layout_force
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/205/15.0
:alt: Try me on Runbot
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/webui/builds.html?repo=OCA/social&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Expand Down Expand Up @@ -73,7 +73,7 @@ Bug Tracker
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.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_layout_force%0Aversion:%2015.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_layout_force%0Aversion:%2016.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.

Expand All @@ -91,6 +91,7 @@ Contributors
* `Camptocamp <https://www.camptocamp.com>`_

* Iván Todorovich <[email protected]>
* Abraham Anes <[email protected]>

Maintainers
~~~~~~~~~~~
Expand All @@ -113,6 +114,6 @@ Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-ivantodorovich|

This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_layout_force>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/16.0/mail_layout_force>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion mail_layout_force/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"name": "Mail Layout Force",
"summary": "Force a mail layout on selected email templates",
"version": "15.0.1.0.0",
"version": "16.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"maintainers": ["ivantodorovich"],
"website": "https://github.com/OCA/social",
Expand Down
2 changes: 1 addition & 1 deletion mail_layout_force/models/mail_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def _ensure_force_email_layout_xml_id(self):
for rec in missing
]
self.env["ir.model.data"].sudo().create(vals)
self.force_email_layout_id.invalidate_cache(["xml_id"])
self.force_email_layout_id.invalidate_recordset(["xml_id"])

@api.model_create_multi
def create(self, vals_list):
Expand Down
1 change: 1 addition & 0 deletions mail_layout_force/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* `Camptocamp <https://www.camptocamp.com>`_

* Iván Todorovich <[email protected]>
* Abraham Anes <[email protected]>
8 changes: 5 additions & 3 deletions mail_layout_force/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ <h1 class="title">Mail Layout Force</h1>
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" 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" 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" href="https://github.com/OCA/social/tree/15.0/mail_layout_force"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-15-0/social-15-0-mail_layout_force"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/205/15.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" 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" 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" href="https://github.com/OCA/social/tree/16.0/mail_layout_force"><img alt="OCA/social" src="https://img.shields.io/badge/github-OCA%2Fsocial-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/social-16-0/social-16-0-mail_layout_force"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?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>
<p>Odoo will add a default email layout on most commercial communications.</p>
<p>The email layout is a <tt class="docutils literal">QWeb</tt> view that ends up wrapping the message body
when sending an email. It usually displays the related document reference,
Expand Down Expand Up @@ -417,7 +417,7 @@ <h1><a class="toc-backref" href="#id2">Bug Tracker</a></h1>
<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.
If you spotted it first, help us smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_layout_force%0Aversion:%2015.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_layout_force%0Aversion:%2016.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>
</div>
<div class="section" id="credits">
Expand All @@ -438,6 +438,8 @@ <h2><a class="toc-backref" href="#id5">Contributors</a></h2>
</ul>
</blockquote>
</li>
<li><p class="first">Abraham Anes &lt;<a class="reference external" href="mailto:abrahamanes&#64;gmail.com">abrahamanes&#64;gmail.com</a>&gt;</p>
</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand All @@ -449,7 +451,7 @@ <h2><a class="toc-backref" href="#id6">Maintainers</a></h2>
promote its widespread use.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainer</a>:</p>
<p><a class="reference external" href="https://github.com/ivantodorovich"><img alt="ivantodorovich" src="https://github.com/ivantodorovich.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/15.0/mail_layout_force">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/16.0/mail_layout_force">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>
</div>
</div>
Expand Down
11 changes: 3 additions & 8 deletions mail_layout_force/wizards/mail_compose_message.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Copyright 2022 Camptocamp SA (https://www.camptocamp.com).
# @author Iván Todorovich <[email protected]>
# Copyright 2023 Abraham Anes <[email protected]>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import models
Expand All @@ -10,13 +11,7 @@ class MailComposer(models.TransientModel):

def _action_send_mail(self, auto_commit=False):
# OVERRIDE to force the email_layout_xmlid defined on the mail.template
res = []
for rec in self:
if rec.template_id.force_email_layout_id:
rec = rec.with_context(
custom_layout=self.template_id.force_email_layout_id.xml_id
)
res.append(
super(MailComposer, rec)._action_send_mail(auto_commit=auto_commit)
)
return all(res)
rec.email_layout_xmlid = rec.template_id.force_email_layout_id.xml_id
return super(MailComposer, self)._action_send_mail(auto_commit=auto_commit)

0 comments on commit 9e6d483

Please sign in to comment.