[MIG] mail_layout_force: Migration to 15.0

pull/1333/head
Yoshi Tashiro 2022-10-02 04:10:20 +00:00 committed by OCA-git-bot
parent 0838f1e58b
commit 1a022b70f4
7 changed files with 21 additions and 19 deletions

View File

@ -14,13 +14,13 @@ 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/14.0/mail_layout_force
:target: https://github.com/OCA/social/tree/15.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-14-0/social-14-0-mail_layout_force
:target: https://translation.odoo-community.org/projects/social-15-0/social-15-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/14.0
:target: https://runbot.odoo-community.org/runbot/205/15.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@ -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:%2014.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:%2015.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.
@ -113,6 +113,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/14.0/mail_layout_force>`_ project on GitHub.
This module is part of the `OCA/social <https://github.com/OCA/social/tree/15.0/mail_layout_force>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -5,7 +5,7 @@
{
"name": "Mail Layout Force",
"summary": "Force a mail layout on selected email templates",
"version": "14.0.1.0.0",
"version": "15.0.1.0.0",
"author": "Camptocamp, Odoo Community Association (OCA)",
"maintainers": ["ivantodorovich"],
"website": "https://github.com/OCA/social",

View File

@ -7,7 +7,7 @@
<odoo>
<template id="mail_layout_noop" name="Mail: No-Layout notification template">
<t t-raw="message.body" />
<t t-out="message.body" />
</template>
</odoo>

View File

@ -64,7 +64,7 @@
<!-- CONTENT -->
<tr>
<td style="min-width: 590px;">
<t t-raw="message.body" />
<t t-out="message.body" />
</td>
</tr>
<!-- FOOTER -->

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.15.1: http://docutils.sourceforge.net/" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>Mail Layout Force</title>
<style type="text/css">
@ -367,7 +367,7 @@ ul.auto-toc {
!! 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/14.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-14-0/social-14-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/14.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/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>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,
@ -417,7 +417,7 @@ You can see how the existing layouts are defined for details or inspiration:</p>
<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:%2014.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:%2015.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">
@ -449,7 +449,7 @@ mission is to support the collaborative development of Odoo features and
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/14.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/15.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>

View File

@ -2,10 +2,10 @@
# @author Iván Todorovich <ivan.todorovich@camptocamp.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo.tests import SavepointCase
from odoo.tests import TransactionCase
class TestMailLayoutForce(SavepointCase):
class TestMailLayoutForce(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
@ -15,7 +15,7 @@ class TestMailLayoutForce(SavepointCase):
"name": "Test Layout",
"type": "qweb",
"mode": "primary",
"arch": "<t t-name='test'><h1></h1><t t-raw='message.body'/></t>",
"arch": "<t t-name='test'><h1></h1><t t-out='message.body'/></t>",
}
)
cls.template = cls.env["mail.template"].create(
@ -67,7 +67,7 @@ class TestMailLayoutForce(SavepointCase):
}
)
)
composer.onchange_template_id_wrapper()
composer.send_mail()
composer._onchange_template_id_wrapper()
composer._action_send_mail()
message = self.partner.message_ids[-1]
self.assertEqual(message.mail_ids.body_html.strip(), "<h1></h1><p>Test</p>")

View File

@ -8,7 +8,7 @@ from odoo import models
class MailComposer(models.TransientModel):
_inherit = "mail.compose.message"
def send_mail(self, auto_commit=False):
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:
@ -16,5 +16,7 @@ class MailComposer(models.TransientModel):
rec = rec.with_context(
custom_layout=self.template_id.force_email_layout_id.xml_id
)
res.append(super(MailComposer, rec).send_mail(auto_commit=auto_commit))
res.append(
super(MailComposer, rec)._action_send_mail(auto_commit=auto_commit)
)
return all(res)