diff --git a/mail_layout_preview/README.rst b/mail_layout_preview/README.rst
index 9ab4c4329..f464cc7ee 100644
--- a/mail_layout_preview/README.rst
+++ b/mail_layout_preview/README.rst
@@ -14,13 +14,13 @@ Mail Preview
: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/13.0/mail_layout_preview
+ :target: https://github.com/OCA/social/tree/14.0/mail_layout_preview
:alt: OCA/social
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
- :target: https://translation.odoo-community.org/projects/social-13-0/social-13-0-mail_layout_preview
+ :target: https://translation.odoo-community.org/projects/social-14-0/social-14-0-mail_layout_preview
: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/13.0
+ :target: https://runbot.odoo-community.org/runbot/205/14.0
:alt: Try me on Runbot
|badge1| |badge2| |badge3| |badge4| |badge5|
@@ -57,7 +57,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 smashing it by providing a detailed and welcomed
-`feedback `_.
+`feedback `_.
Do not contact contributors directly about support or help with technical issues.
@@ -73,6 +73,14 @@ Contributors
~~~~~~~~~~~~
* Simone Orsi
+* Phuc Tran Thanh
+
+Other credits
+~~~~~~~~~~~~~
+
+The development of this module has been financially supported by:
+
+* Camptocamp
Maintainers
~~~~~~~~~~~
@@ -87,6 +95,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_layout_preview/__manifest__.py b/mail_layout_preview/__manifest__.py
index a63cb3818..425bccadb 100644
--- a/mail_layout_preview/__manifest__.py
+++ b/mail_layout_preview/__manifest__.py
@@ -5,7 +5,7 @@
"name": "Mail Preview",
"summary": """
Preview email templates in the browser""",
- "version": "13.0.1.0.0",
+ "version": "14.0.1.0.0",
"license": "AGPL-3",
"author": "Camptocamp SA,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
diff --git a/mail_layout_preview/controllers/layout_preview.py b/mail_layout_preview/controllers/layout_preview.py
index b2e72d85d..9271357c2 100644
--- a/mail_layout_preview/controllers/layout_preview.py
+++ b/mail_layout_preview/controllers/layout_preview.py
@@ -43,5 +43,5 @@ class Preview(http.Controller):
else:
# got a XID
template = env.ref(templ_id.strip())
- result = template.generate_email(record.id)
+ result = template.generate_email(record.id, ["body_html"])
return request.make_response(result["body_html"])
diff --git a/mail_layout_preview/i18n/mail_layout_preview.pot b/mail_layout_preview/i18n/mail_layout_preview.pot
index 49aef304c..d290be8d2 100644
--- a/mail_layout_preview/i18n/mail_layout_preview.pot
+++ b/mail_layout_preview/i18n/mail_layout_preview.pot
@@ -4,7 +4,7 @@
#
msgid ""
msgstr ""
-"Project-Id-Version: Odoo Server 13.0\n"
+"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: \n"
"Language-Team: \n"
@@ -34,7 +34,12 @@ msgid "Copy the link"
msgstr ""
#. module: mail_layout_preview
-#: model:ir.model,name:mail_layout_preview.model_email_template_preview
+#: model:ir.model.fields,field_description:mail_layout_preview.field_mail_template_preview__display_name
+msgid "Display Name"
+msgstr ""
+
+#. module: mail_layout_preview
+#: model:ir.model,name:mail_layout_preview.model_mail_template_preview
msgid "Email Template Preview"
msgstr ""
@@ -49,7 +54,7 @@ msgid "Find your template"
msgstr ""
#. module: mail_layout_preview
-#: model:ir.model.fields,field_description:mail_layout_preview.field_email_template_preview__layout_preview_url
+#: model:ir.model.fields,field_description:mail_layout_preview.field_mail_template_preview__layout_preview_url
msgid "Full layout preview"
msgstr ""
@@ -58,6 +63,16 @@ msgstr ""
msgid "Here you find all the template for the given model."
msgstr ""
+#. module: mail_layout_preview
+#: model:ir.model.fields,field_description:mail_layout_preview.field_mail_template_preview__id
+msgid "ID"
+msgstr ""
+
+#. module: mail_layout_preview
+#: model:ir.model.fields,field_description:mail_layout_preview.field_mail_template_preview____last_update
+msgid "Last Modified on"
+msgstr ""
+
#. module: mail_layout_preview
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list
msgid "Load it"
diff --git a/mail_layout_preview/readme/CONTRIBUTORS.rst b/mail_layout_preview/readme/CONTRIBUTORS.rst
index f583948be..2b607df86 100644
--- a/mail_layout_preview/readme/CONTRIBUTORS.rst
+++ b/mail_layout_preview/readme/CONTRIBUTORS.rst
@@ -1 +1,2 @@
* Simone Orsi
+* Phuc Tran Thanh
diff --git a/mail_layout_preview/readme/CREDITS.rst b/mail_layout_preview/readme/CREDITS.rst
new file mode 100644
index 000000000..f5cc070c7
--- /dev/null
+++ b/mail_layout_preview/readme/CREDITS.rst
@@ -0,0 +1,3 @@
+The development of this module has been financially supported by:
+
+* Camptocamp
diff --git a/mail_layout_preview/static/description/index.html b/mail_layout_preview/static/description/index.html
index 5bc5b846b..5f8d132fe 100644
--- a/mail_layout_preview/static/description/index.html
+++ b/mail_layout_preview/static/description/index.html
@@ -367,7 +367,7 @@ ul.auto-toc {
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
-

+

The purpose of this module is to help development of email templates
allowing to render the full layout preview of each of them.
Odoo already allows you do preview emails but they are wrapped into Odoo backend theme.
@@ -380,7 +380,8 @@ allowing to render the full layout preview of each of them.
Credits
@@ -403,7 +404,7 @@ Follow the instructions there on how to use the links.
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 smashing it by providing a detailed and welcomed
-feedback.
+feedback.
Do not contact contributors directly about support or help with technical issues.
@@ -418,16 +419,24 @@ If you spotted it first, help us smashing it by providing a detailed and welcome
+
+
+
+
The development of this module has been financially supported by:
+
-
+
This module is maintained by the OCA.
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_layout_preview/tests/test_layout_preview.py b/mail_layout_preview/tests/test_layout_preview.py
index bdfa1ef78..5bcfe0ea7 100644
--- a/mail_layout_preview/tests/test_layout_preview.py
+++ b/mail_layout_preview/tests/test_layout_preview.py
@@ -16,7 +16,6 @@ class TestLayoutMixin(object):
"subject": "Preview ${object.name}",
"body_html": "Hello ${object.name}
",
"model_id": env["ir.model"]._get(model).id,
- "user_signature": False,
}
vals.update(kw)
return env["mail.template"].create(vals)
@@ -28,14 +27,17 @@ class TestLayoutPreview(SavepointCase, TestLayoutMixin):
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
- cls.wiz_model = cls.env["email_template.preview"]
+ cls.wiz_model = cls.env["mail.template.preview"]
cls.partner = cls.env.ref("base.res_partner_4")
cls.tmpl = cls._create_template(cls.env, cls.partner._name)
def test_wizard_preview_url(self):
- wiz = self.wiz_model.with_context(
- template_id=self.tmpl.id, default_res_id=self.partner.id
- ).create({})
+ wiz = self.wiz_model.create(
+ {
+ "mail_template_id": self.tmpl.id,
+ "resource_ref": "{},{}".format(self.partner._name, self.partner.id),
+ }
+ )
self.assertEqual(
wiz.layout_preview_url,
"/email-preview/res.partner/{}/{}/".format(self.tmpl.id, self.partner.id),
diff --git a/mail_layout_preview/wizard/email_template_preview.py b/mail_layout_preview/wizard/email_template_preview.py
index ee22b15c4..bbfaa34d3 100644
--- a/mail_layout_preview/wizard/email_template_preview.py
+++ b/mail_layout_preview/wizard/email_template_preview.py
@@ -4,8 +4,8 @@
from odoo import api, fields, models
-class TemplatePreview(models.TransientModel):
- _inherit = "email_template.preview"
+class MailTemplatePreview(models.TransientModel):
+ _inherit = "mail.template.preview"
_url_pattern = "/email-preview/{model}/{templ_id}/{rec_id}/"
@@ -13,14 +13,14 @@ class TemplatePreview(models.TransientModel):
string="Full layout preview", compute="_compute_layout_preview_url"
)
- @api.depends("res_id")
+ @api.depends("resource_ref", "model_id", "mail_template_id")
def _compute_layout_preview_url(self):
for rec in self:
- if self.env.context.get("template_id"):
+ if rec.mail_template_id:
rec.layout_preview_url = self._url_pattern.format(
model=rec.model_id.model,
- templ_id=self.env.context["template_id"],
- rec_id=rec.res_id,
+ templ_id=rec.mail_template_id.id,
+ rec_id=rec.resource_ref.id,
)
else:
rec.layout_preview_url = ""
diff --git a/mail_layout_preview/wizard/email_template_preview.xml b/mail_layout_preview/wizard/email_template_preview.xml
index a052694da..7a0e707d7 100644
--- a/mail_layout_preview/wizard/email_template_preview.xml
+++ b/mail_layout_preview/wizard/email_template_preview.xml
@@ -1,8 +1,8 @@
- email_template.preview
-
+ mail.template.preview
+