Skip to content

Commit

Permalink
[MIG] mail_layout_preview: Migration to 18.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Kimkhoi3010 committed Nov 15, 2024
1 parent 6aa3f5c commit 74c8618
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 58 deletions.
21 changes: 11 additions & 10 deletions mail_layout_preview/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ Mail Preview
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
: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/18.0/mail_layout_preview
:alt: OCA/social
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github
:target: https://github.com/OCA/mail/tree/18.0/mail_layout_preview
:alt: OCA/mail
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/social-18-0/social-18-0-mail_layout_preview
:target: https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_layout_preview
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=18.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/mail&target_branch=18.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|
Expand Down Expand Up @@ -60,10 +60,10 @@ how to use the links.
Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/mail/issues>`_.
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
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_layout_preview%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
`feedback <https://github.com/OCA/mail/issues/new?body=module:%20mail_layout_preview%0Aversion:%2018.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 @@ -81,12 +81,13 @@ Contributors
- Simone Orsi <[email protected]>
- Phuc Tran Thanh <[email protected]>
- Son Ho <[email protected]>
- Khoi (Kien Kim) <[email protected]>

Other credits
-------------

The development and migration of this module from 15.0 to 16.0 has been
financially supported by:
The development and migration of this module from 15.0 to 16.0 and from
17.0 to 18.0 has been financially supported by:

- Camptocamp

Expand All @@ -103,6 +104,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 <https://github.com/OCA/social/tree/18.0/mail_layout_preview>`_ project on GitHub.
This module is part of the `OCA/mail <https://github.com/OCA/mail/tree/18.0/mail_layout_preview>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
4 changes: 2 additions & 2 deletions mail_layout_preview/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"name": "Mail Preview",
"summary": """
Preview email templates in the browser""",
"version": "17.0.1.0.0",
"version": "18.0.1.0.0",
"license": "AGPL-3",
"author": "Camptocamp,Odoo Community Association (OCA)",
"website": "https://github.com/OCA/social",
"website": "https://github.com/OCA/mail",
"depends": ["mail"],
"data": ["templates/email_preview.xml", "wizard/email_template_preview.xml"],
"development_status": "Beta",
Expand Down
1 change: 1 addition & 0 deletions mail_layout_preview/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Simone Orsi \<<[email protected]>\>
- Phuc Tran Thanh \<<[email protected]>\>
- Son Ho \<<[email protected]>\>
- Khoi (Kien Kim) \<<[email protected]>\>
4 changes: 2 additions & 2 deletions mail_layout_preview/readme/CREDITS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
The development and migration of this module from 15.0 to 16.0 has been
financially supported by:
The development and migration of this module from 15.0 to 16.0 and
from 17.0 to 18.0 has been financially supported by:

- Camptocamp
13 changes: 7 additions & 6 deletions mail_layout_preview/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ <h1 class="title">Mail Preview</h1>
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4b096426f65610ad76b1408c5d42186b2e65076726ffd214653362f77bd00fe2
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/18.0/mail_layout_preview"><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-18-0/social-18-0-mail_layout_preview"><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=18.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/mail/tree/18.0/mail_layout_preview"><img alt="OCA/mail" src="https://img.shields.io/badge/github-OCA%2Fmail-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/mail-18-0/mail-18-0-mail_layout_preview"><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/mail&amp;target_branch=18.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>The purpose of this module is to help development of email templates
allowing to render the full layout preview of each of them.</p>
<p>Odoo already allows you do preview emails but they are wrapped into Odoo
Expand Down Expand Up @@ -406,10 +406,10 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#toc-entry-2">Bug Tracker</a></h1>
<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/mail/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 to smash it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20mail_layout_preview%0Aversion:%2018.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/mail/issues/new?body=module:%20mail_layout_preview%0Aversion:%2018.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 @@ -426,12 +426,13 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
<li>Simone Orsi &lt;<a class="reference external" href="mailto:simahawk&#64;gmail.com">simahawk&#64;gmail.com</a>&gt;</li>
<li>Phuc Tran Thanh &lt;<a class="reference external" href="mailto:phuc&#64;trobz.com">phuc&#64;trobz.com</a>&gt;</li>
<li>Son Ho &lt;<a class="reference external" href="mailto:sonhd&#64;trobz.com">sonhd&#64;trobz.com</a>&gt;</li>
<li>Khoi (Kien Kim) &lt;<a class="reference external" href="mailto:khoikk&#64;trobz.com">khoikk&#64;trobz.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#toc-entry-6">Other credits</a></h2>
<p>The development and migration of this module from 15.0 to 16.0 has been
financially supported by:</p>
<p>The development and migration of this module from 15.0 to 16.0 and from
17.0 to 18.0 has been financially supported by:</p>
<ul class="simple">
<li>Camptocamp</li>
</ul>
Expand All @@ -445,7 +446,7 @@ <h2><a class="toc-backref" href="#toc-entry-7">Maintainers</a></h2>
<p>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.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/social/tree/18.0/mail_layout_preview">OCA/social</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/mail/tree/18.0/mail_layout_preview">OCA/mail</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
77 changes: 40 additions & 37 deletions mail_layout_preview/templates/email_preview.xml
Original file line number Diff line number Diff line change
@@ -1,54 +1,57 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>

<template id="email_templates_list">
<t t-call="web.layout">
<h1>
<template id="email_templates_list">
<t t-call="web.layout">
<h1>
Email templates for: <span t-esc="model" />
</h1>
<t t-if="not templates">
<p>No template found.</p>
</t>
<t t-if="templates">
<div class="instructions">
<p>Here you find all the template for the given model.</p>
<ol>
<li>Find your template</li>
<li>Copy the link</li>
<li>
<t t-if="not templates">
<p>No template found.</p>
</t>
<t t-if="templates">
<div class="instructions">
<p>Here you find all the template for the given model.</p>
<ol>
<li>Find your template</li>
<li>Copy the link</li>
<li>
Paste into the address bar and change the record ID (the last value in the URL).
<br
/>If you don't know the ID of the record, just browse to the record via odoo interface and check its ID in the address bar `#id=XXX`.
/>If you don't know the ID of the record, just browse to the record via odoo interface and check its ID in the address bar `#id=XXX`.
</li>
<li>Load it</li>
</ol>
</div>
<ol class="email-template-list">
<t t-foreach="templates" t-as="tmpl">
<t t-set="xid" t-value="xids.get(tmpl.id)" />
<li class="email-template-item" style="padding:0.5em">
<strong>Name:</strong> <span class="name" t-field="tmpl.name" /><br />
<t t-if="xid">
<strong>XMLID:</strong> <span class="xid" t-esc="xid" /><br />
</t>
<strong>Link:</strong>
<a
<li>Load it</li>
</ol>
</div>
<ol class="email-template-list">
<t t-foreach="templates" t-as="tmpl">
<t t-set="xid" t-value="xids.get(tmpl.id)" />
<li class="email-template-item" style="padding:0.5em">
<strong>Name:</strong>
<span class="name" t-field="tmpl.name" />
<br />
<t t-if="xid">
<strong>XMLID:</strong>
<span class="xid" t-esc="xid" />
<br />
</t>
<strong>Link:</strong>
<a
class="preview"
t-attf-href="/email-preview/#{model}/#{xid or tmpl.id}/1"
>
Preview
</a><br />
<a
</a>
<br />
<a
class="preview"
t-attf-href="/web#id=#{tmpl.id}&amp;view_type=form&amp;model=mail.template"
>
View in backend
</a>
</li>
</t>
</ol>
</t>
</t>
</template>

</li>
</t>
</ol>
</t>
</t>
</template>
</odoo>
2 changes: 1 addition & 1 deletion mail_layout_preview/tests/test_layout_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,4 @@ def test_controller2(self):
tmpl = self._create_template(self.env, model)
response = self.url_open(self.base_url + f"{model}/{tmpl.id}/{partner.id}/")
content = response.content.decode()
self.assertIn("<p>Hello %s</p>" % (partner.name), content)
self.assertIn(f"<p>Hello {partner.name}</p>", content)

0 comments on commit 74c8618

Please sign in to comment.