-
-
Notifications
You must be signed in to change notification settings - Fork 637
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by simahawk
- Loading branch information
Showing
20 changed files
with
916 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
============ | ||
Mail Preview | ||
============ | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Beta | ||
.. |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/15.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-15-0/social-15-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/webui/builds.html?repo=OCA/social&target_branch=15.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. | ||
|
||
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** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
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 | ||
|
||
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. | ||
|
||
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_preview%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. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Camptocamp SA | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Simone Orsi <[email protected]> | ||
* Phuc Tran Thanh <[email protected]> | ||
* Son Ho <[email protected]> | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
The development of this module has been financially supported by: | ||
|
||
* Camptocamp | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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/15.0/mail_layout_preview>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import controllers | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Copyright 2020 Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Mail Preview", | ||
"summary": """ | ||
Preview email templates in the browser""", | ||
"version": "15.0.0.1.0", | ||
"license": "AGPL-3", | ||
"author": "Camptocamp SA,Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/social", | ||
"depends": ["mail"], | ||
"data": ["templates/email_preview.xml", "wizard/email_template_preview.xml"], | ||
"development_status": "Beta", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import layout_preview |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Copyright 2020 Simone Orsi - Camptocamp SA | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) | ||
|
||
from odoo import http | ||
from odoo.http import request | ||
|
||
|
||
class Preview(http.Controller): | ||
|
||
_list_template = "mail_layout_preview.email_templates_list" | ||
|
||
@http.route( | ||
["/email-preview/<string:model>"], type="http", auth="user", website=True | ||
) | ||
def template_list(self, model, **kw): | ||
env = request.env | ||
templates = env["mail.template"].search([("model_id.model", "=", model)]) | ||
xids = templates.get_external_id() | ||
return request.render( | ||
self._list_template, {"model": model, "templates": templates, "xids": xids} | ||
) | ||
|
||
@http.route( | ||
["/email-preview/<string:model>/<string:templ_id>/<int:rec_id>"], | ||
type="http", | ||
auth="user", | ||
website=True, | ||
) | ||
def preview(self, model, templ_id, rec_id, **kw): | ||
"""Render an email template to verify look and feel. | ||
Provide model, record id and an email template to render. | ||
Example for event registration email: | ||
/email-preview/event.registration/event.event_subscription/5 | ||
""" | ||
env = request.env | ||
record = env[model].browse(rec_id) | ||
if templ_id.isdigit(): | ||
# got an ID | ||
template = env["mail.template"].browse(int(templ_id)) | ||
else: | ||
# got a XID | ||
template = env.ref(templ_id.strip()) | ||
result = template.generate_email(record.id, ["body_html"]) | ||
return request.make_response(result["body_html"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * mail_layout_preview | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "<strong>Link:</strong>" | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "<strong>Name:</strong>" | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "<strong>XMLID:</strong>" | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "Copy the link" | ||
msgstr "" | ||
|
||
#. module: mail_layout_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 "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "Email templates for:" | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "Find your template" | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model:ir.model.fields,field_description:mail_layout_preview.field_mail_template_preview__layout_preview_url | ||
msgid "Full layout preview" | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
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" | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "No template found." | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "" | ||
"Paste into the address bar and change the record ID (the last value in the URL).\n" | ||
" <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`." | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "Preview" | ||
msgstr "" | ||
|
||
#. module: mail_layout_preview | ||
#: model_terms:ir.ui.view,arch_db:mail_layout_preview.email_templates_list | ||
msgid "View in backend" | ||
msgstr "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* Simone Orsi <[email protected]> | ||
* Phuc Tran Thanh <[email protected]> | ||
* Son Ho <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The development of this module has been financially supported by: | ||
|
||
* Camptocamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
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. | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
* 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. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.