Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[18.0][MIG] mail_layout_preview: Migration to 18.0 #7

Merged
merged 19 commits into from
Nov 19, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[IMP] mail_layout_preview: pre-commit auto fixes
bizzappdev authored and Kimkhoi3010 committed Nov 13, 2024
commit 67e2a105d48df78477fee661f551788aee3bf846
50 changes: 27 additions & 23 deletions mail_layout_preview/README.rst
Original file line number Diff line number Diff line change
@@ -17,23 +17,25 @@ 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/16.0/mail_layout_preview
:target: https://github.com/OCA/social/tree/17.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-16-0/social-16-0-mail_layout_preview
:target: https://translation.odoo-community.org/projects/social-17-0/social-17-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=16.0
:target: https://runboat.odoo-community.org/builds?repo=OCA/social&target_branch=17.0
:alt: Try me on Runboat

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

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.
Odoo already allows you do preview emails but they are wrapped into Odoo
backend theme.

NOTE: to make work properly your emails it's strongly recommended to use `mail_inline_css` to include all styles in the body of the email.
NOTE: to make work properly your emails it's strongly recommended to use
mail_inline_css to include all styles in the body of the email.

**Table of contents**

@@ -43,51 +45,53 @@ NOTE: to make work properly your emails it's strongly recommended to use `mail_i
Usage
=====

* Go to a template and click on the preview button
* Select desired params and click on "Full layout preview" link
* You'll get to the preview
- Go to a template and click on the preview button
- Select desired params and click on "Full layout preview" link
- You'll get to the preview

As a developer, you can see a list of all templates for a model by going to:
As a developer, you can see a list of all templates for a model by going
to:

/email-preview/$model.name
/email-preview/$model.name

You'll get a list of all the templates.
Follow the instructions there on how to use the links.
You'll get a list of all the templates. Follow the instructions there on
how to use the links.

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 to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/social/issues/new?body=module:%20mail_layout_preview%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_layout_preview%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.

Credits
=======

Authors
~~~~~~~
-------

* Camptocamp SA

Contributors
~~~~~~~~~~~~
------------

* Simone Orsi <simahawk@gmail.com>
* Phuc Tran Thanh <phuc@trobz.com>
* Son Ho <sonhd@trobz.com>
- Simone Orsi <simahawk@gmail.com>
- Phuc Tran Thanh <phuc@trobz.com>
- Son Ho <sonhd@trobz.com>

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 has been
financially supported by:

* Camptocamp
- Camptocamp

Maintainers
~~~~~~~~~~~
-----------

This module is maintained by the OCA.

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

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 0 additions & 1 deletion mail_layout_preview/controllers/layout_preview.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,6 @@


class Preview(http.Controller):

_list_template = "mail_layout_preview.email_templates_list"

@http.route(
3 changes: 3 additions & 0 deletions mail_layout_preview/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
3 changes: 3 additions & 0 deletions mail_layout_preview/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Simone Orsi \<<simahawk@gmail.com>\>
- Phuc Tran Thanh \<<phuc@trobz.com>\>
- Son Ho \<<sonhd@trobz.com>\>
3 changes: 0 additions & 3 deletions mail_layout_preview/readme/CONTRIBUTORS.rst

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +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 has been
financially supported by:

* Camptocamp
- Camptocamp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
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.
Odoo already allows you do preview emails but they are wrapped into Odoo
backend theme.

NOTE: to make work properly your emails it's strongly recommended to use `mail_inline_css` to include all styles in the body of the email.
NOTE: to make work properly your emails it's strongly recommended to use
mail_inline_css to include all styles in the body of the email.
11 changes: 11 additions & 0 deletions mail_layout_preview/readme/USAGE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- Go to a template and click on the preview button
- Select desired params and click on "Full layout preview" link
- You'll get to the preview

As a developer, you can see a list of all templates for a model by going
to:

> /email-preview/\$model.name

You'll get a list of all the templates. Follow the instructions there on
how to use the links.
10 changes: 0 additions & 10 deletions mail_layout_preview/readme/USAGE.rst

This file was deleted.

23 changes: 13 additions & 10 deletions mail_layout_preview/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
@@ -369,11 +368,13 @@ <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/16.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-16-0/social-16-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=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_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-17-0/social-17-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=17.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 backend theme.</p>
<p>NOTE: to make work properly your emails it’s strongly recommended to use <cite>mail_inline_css</cite> to include all styles in the body of the email.</p>
<p>Odoo already allows you do preview emails but they are wrapped into Odoo
backend theme.</p>
<p>NOTE: to make work properly your emails it’s strongly recommended to use
mail_inline_css to include all styles in the body of the email.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
@@ -395,18 +396,19 @@ <h1><a class="toc-backref" href="#toc-entry-1">Usage</a></h1>
<li>Select desired params and click on “Full layout preview” link</li>
<li>You’ll get to the preview</li>
</ul>
<p>As a developer, you can see a list of all templates for a model by going to:</p>
<p>As a developer, you can see a list of all templates for a model by going
to:</p>
<blockquote>
/email-preview/$model.name</blockquote>
<p>You’ll get a list of all the templates.
Follow the instructions there on how to use the links.</p>
<p>You’ll get a list of all the templates. Follow the instructions there on
how to use the links.</p>
</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>.
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:%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_layout_preview%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>
</div>
<div class="section" id="credits">
@@ -427,7 +429,8 @@ <h2><a class="toc-backref" href="#toc-entry-5">Contributors</a></h2>
</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 has been
financially supported by:</p>
<ul class="simple">
<li>Camptocamp</li>
</ul>
@@ -439,7 +442,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/16.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/social/tree/17.0/mail_layout_preview">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>
10 changes: 4 additions & 6 deletions mail_layout_preview/tests/test_layout_preview.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
from odoo.tests.common import HttpCase, TransactionCase, tagged


class TestLayoutMixin(object):
class TestLayoutMixin:
@staticmethod
def _create_template(env, model, **kw):
vals = {
@@ -35,12 +35,12 @@ def test_wizard_preview_url(self):
wiz = self.wiz_model.create(
{
"mail_template_id": self.tmpl.id,
"resource_ref": "{},{}".format(self.partner._name, self.partner.id),
"resource_ref": f"{self.partner._name},{self.partner.id}",
}
)
self.assertEqual(
wiz.layout_preview_url,
"/email-preview/res.partner/{}/{}/".format(self.tmpl.id, self.partner.id),
f"/email-preview/res.partner/{self.tmpl.id}/{self.partner.id}/",
)


@@ -71,8 +71,6 @@ def test_controller2(self):
partner = self.env.ref("base.res_partner_4")
model = partner._name
tmpl = self._create_template(self.env, model)
response = self.url_open(
self.base_url + "{}/{}/{}/".format(model, tmpl.id, partner.id)
)
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)