Merge PR #1072 into 15.0

Signed-off-by hbrunn
pull/1114/head
OCA-git-bot 2023-03-20 13:07:46 +00:00
commit ff22f4841e
30 changed files with 1719 additions and 0 deletions

View File

@ -0,0 +1,104 @@
========================
QWeb for email templates
========================
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/email_template_qweb
: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-email_template_qweb
: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|
This module was written to allow you to write email templates in `QWeb view` instead
of QWeb. The advantage here is that with QWeb View, you can make use of
inheritance and the ``call`` statement, which allows you to reuse designs and
snippets in multiple templates, making your development process simpler.
Furthermore, QWeb views are easier to edit with the integrated ACE editor.
**Table of contents**
.. contents::
:local:
Usage
=====
To use this module, you need to:
#. Select `QWeb View` in the field `Body templating engine`
#. Select a `QWeb View` to be used to render the body field
#. Apart from `QWeb View` standard variables, you also have access to ``object`` and ``email_template``, which are browse records of the current object and the email template in use, respectively.
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:%20email_template_qweb%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
~~~~~~~
* Therp BV
Contributors
~~~~~~~~~~~~
* Holger Brunn <hbrunn@therp.nl>
* Dave Lasley <dave@laslabs.com>
* Carlos Lopez Mite <celm1990@gmail.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* Ernesto Tejeda
* Thomas Fossoul (thomas@niboo.com)
* Phuc Tran Thanh <phuc@trobz.com>
* Foram Shah <foram.shah@initos.com>
* `Trobz <https://trobz.com>`_:
* Dzung Tran <dungtd@trobz.com>
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/email_template_qweb>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

View File

@ -0,0 +1,3 @@
# Copyright 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import models

View File

@ -0,0 +1,15 @@
# Copyright 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "QWeb for email templates",
"version": "15.0.1.0.0",
"author": "Therp BV, Odoo Community Association (OCA)",
"license": "AGPL-3",
"category": "Marketing",
"summary": "Use the QWeb templating mechanism for emails",
"website": "https://github.com/OCA/social",
"depends": ["mail"],
"demo": ["demo/ir_ui_view.xml", "demo/mail_template.xml"],
"data": ["views/mail_template.xml"],
"installable": True,
}

View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<template id="view_email_template_corporate_identity">
<body>
<html>
<img
style="float: right"
t-attf-src="data:image;base64,{{env.user.company_id.logo}}"
/>
<!-- if some template calling us sets this variable,
we print a h1 tag /-->
<h1 t-if="email_heading"><t t-esc="email_heading" /></h1>
<t t-out="0" />
<!-- use some standard footer if the user doesn't have
a signature /-->
<footer t-if="not email_use_user_signature">
<p>
<a t-att-href="env.user.company_id.website">
<t t-esc="env.user.company_id.name" />
</a>
</p>
<p><t t-esc="env.user.company_id.phone" /></p>
</footer>
<footer t-if="email_use_user_signature">
<t t-out="env.user.signature" />
</footer>
</html>
</body>
</template>
<template id="view_email_template_demo1">
<!-- because we can simply call the ci here, we don't need to
repeat it /-->
<t t-call="email_template_qweb.view_email_template_corporate_identity">
<!-- the template we call uses this as title if we set it /-->
<t t-set="email_heading" t-value="email_template.subject" />
<h2>Dear <t t-esc="object.name" />,</h2>
<p>
This is an email template using qweb.
</p>
</t>
</template>
</odoo>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="email_template_demo1" model="mail.template">
<field name="name">QWeb demo</field>
<field name="body_type">qweb_view</field>
<field name="body_view_id" ref="view_email_template_demo1" />
<field name="model_id" ref="base.model_res_users" />
<field name="subject">QWeb demo email</field>
</record>
</odoo>

View File

@ -0,0 +1,80 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-10 11:20+0000\n"
"PO-Revision-Date: 2017-02-10 11:20+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
#, fuzzy
msgid "Body View"
msgstr "Nachrichtenansicht"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr "Nachrichtenvorlagen Generator"
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Sehr geehrter"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "E-Mail Vorlagen"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "QWeb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "QWeb Demo-E-Mail"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "Dies ist eine E-Mail-Vorlage aus qweb."
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr "Zeige Stilarten"

View File

@ -0,0 +1,81 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
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: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
msgid "Body View"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__display_name
msgid "Display Name"
msgstr ""
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__id
msgid "ID"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template____last_update
msgid "Last Modified on"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr ""
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use translation.\n"
" Note that it will read `arch_db` or `arch_fs` if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr ""

View File

@ -0,0 +1,80 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-10 11:20+0000\n"
"PO-Revision-Date: 2017-02-10 11:20+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
#, fuzzy
msgid "Body View"
msgstr "Vista del cuerpo"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr "Motor de plantilla para el cuerpo del mensaje"
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Estimado"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Plantillas de correo electrónico"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "QWeb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "Correo electrónico demo en QWeb"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "Esto es una plantilla de correo electrónico usando QWeb"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr "Arquitectura de la vista"

View File

@ -0,0 +1,81 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-11-29 14:24+0000\n"
"PO-Revision-Date: 2016-11-29 14:24+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Spanish (Mexico) (https://www.transifex.com/oca/teams/23907/"
"es_MX/)\n"
"Language: es_MX\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
#, fuzzy
msgid "Body View"
msgstr "Vista del cuerpo"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Querido"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Plantillas de Correo Electrónico"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "QWeb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "Correo QWeb de demo"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "Esta es una plantilla de correo utilizando qweb"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr ""

View File

@ -0,0 +1,86 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# Quentin THEURET <odoo@kerpeo.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-22 09:45+0000\n"
"PO-Revision-Date: 2021-03-22 16:46+0000\n"
"Last-Translator: Yves Le Doeuff <yld@alliasys.fr>\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
#, fuzzy
msgid "Body View"
msgstr "Vue du corps"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr "Moteur de modèle de corps"
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Cher"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Modèles de courriel"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "QWeb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "Courriel QWeb de démonstration"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
#, fuzzy
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
"Ce champ doit être utilisé lors de l'accès à l'arche de vue. Il utilisera la "
"traduction.\n"
" Notez qu'il lira `arch_db` ou` arch_fs` s'il "
"est en mode dev-xml."
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "Ceci est un modèle de courriel utilisant qweb."
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr "Architecture de la vue"

View File

@ -0,0 +1,88 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0\n"
"Report-Msgid-Bugs-To: \n"
"PO-Revision-Date: 2021-04-11 18:46+0000\n"
"Last-Translator: Yves Le Doeuff <yld@alliasys.fr>\n"
"Language-Team: none\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 4.3.2\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
msgid "Body View"
msgstr "Vue du corps"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr "Moteur de modèle de corps"
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Cher"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__display_name
msgid "Display Name"
msgstr ""
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Modèles de courriel"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__id
msgid "ID"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template____last_update
msgid "Last Modified on"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "QWeb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "Courriel QWeb de démonstration"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use translation.\n"
" Note that it will read `arch_db` or `arch_fs` if in dev-xml mode."
msgstr ""
"Ce champ doit être utilisé lors de l'accès à la vue arch. Il utilisera la "
"traduction.\n"
" Notez qu'il lira `arch_db` ou` arch_fs` s'il "
"est en mode dev-xml."
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "Ceci est un modèle de courriel utilisant qweb."
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr "Architecture de la vue"

View File

@ -0,0 +1,81 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-02-10 11:20+0000\n"
"PO-Revision-Date: 2017-02-10 11:20+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2016\n"
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
"Language: hr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
#, fuzzy
msgid "Body View"
msgstr "Pregled tijela"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr "Mehanizam predložaka poruke"
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Dragi"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Predlošci mailova"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "QWeb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "QWeb demo email"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "Ovo je predložak emaila korištenjem qweb-a."
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr "Pregled arhitekture"

View File

@ -0,0 +1,81 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# OCA Transbot <transbot@odoo-community.org>, 2016
# Marius Marolla <mariusmarolla@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-17 01:02+0000\n"
"PO-Revision-Date: 2017-05-17 01:02+0000\n"
"Last-Translator: Marius Marolla <mariusmarolla@gmail.com>, 2017\n"
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
"Language: it\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
#, fuzzy
msgid "Body View"
msgstr "Visualizzazione Messaggio"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr "Motore dei Modelli di Messaggio"
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Gentile"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Modelli Email"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "QWeb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "Demo Email QWeb"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "Questo è un modello di email basato su QWeb"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr "Visualizza Architettura"

View File

@ -0,0 +1,80 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# Peter Hageman <hageman.p@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-05-20 08:36+0000\n"
"PO-Revision-Date: 2017-05-20 08:36+0000\n"
"Last-Translator: Peter Hageman <hageman.p@gmail.com>, 2017\n"
"Language-Team: Dutch (Netherlands) (https://www.transifex.com/oca/"
"teams/23907/nl_NL/)\n"
"Language: nl_NL\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
msgid "Body View"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Geachte"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "E-mailsjablonen"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "QWeb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "QWeb demo email"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr ""

View File

@ -0,0 +1,82 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# falexandresilva <falexandresilva@gmail.com>, 2017
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-07-22 00:50+0000\n"
"PO-Revision-Date: 2019-09-17 14:24+0000\n"
"Last-Translator: Rodrigo Macedo <rmsolucoeseminformatic4@gmail.com>\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/"
"teams/23907/pt_BR/)\n"
"Language: pt_BR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=2; plural=n > 1;\n"
"X-Generator: Weblate 3.8\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
#, fuzzy
msgid "Body View"
msgstr "Visualizar Corpo"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr "Motor de modelagem do corpo"
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Caro"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Modelos de E-mail"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr "Qweb"
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr "E-mail de demonstração QWeb"
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "Este é um modelo de e-mail usando o qweb."
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr "Ver Arquitetura"

View File

@ -0,0 +1,80 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
# Jeffery Chenn <jeffery9@gmail.com>, 2016
msgid ""
msgstr ""
"Project-Id-Version: social (9.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-09-02 00:46+0000\n"
"PO-Revision-Date: 2016-09-04 05:55+0000\n"
"Last-Translator: Jeffery Chenn <jeffery9@gmail.com>\n"
"Language-Team: Chinese (China) (http://www.transifex.com/oca/OCA-social-9-0/"
"language/zh_CN/)\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: nplurals=1; plural=0;\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_id
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_id
msgid "Body View"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_type
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_type
msgid "Body templating engine"
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "亲爱的"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Email 模板"
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__jinja2
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__jinja2
msgid "Jinja2"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__email_template_preview__body_type__qweb
#: model:ir.model.fields.selection,name:email_template_qweb.selection__mail_template__body_type__qweb
msgid "QWeb"
msgstr ""
#. module: email_template_qweb
#: model:mail.template,subject:email_template_qweb.email_template_demo1
msgid "QWeb demo email"
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,help:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,help:email_template_qweb.field_mail_template__body_view_arch
msgid ""
"This field should be used when accessing view arch. It will use "
"translation.\n"
" Note that it will read `arch_db` or `arch_fs` "
"if in dev-xml mode."
msgstr ""
#. module: email_template_qweb
#: model_terms:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr ""
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_email_template_preview__body_view_arch
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template__body_view_arch
msgid "View Architecture"
msgstr ""

View File

@ -0,0 +1,29 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import SUPERUSER_ID, api
def migrate(cr, version):
if not version:
return
env = api.Environment(cr, SUPERUSER_ID, {})
body_type = env["ir.model.fields"].search(
[("name", "=", "body_type"), ("model", "=", "mail.template")]
)
# Note: no need to migrate the existing values of the `body_type` of the
# model `mail_template` because Odoo already does it
# See https://github.com/odoo/odoo/blob/15.0/odoo/addons/base/models/ir_model.py#L1351
if body_type:
# qweb -> qweb_view
qweb = env["ir.model.fields.selection"].search(
[("value", "=", "qweb"), ("field_id", "=", body_type.id)]
)
qweb.write({"value": "qweb_view"})
# jinja2 -> qweb
jinja = env["ir.model.fields.selection"].search(
[("value", "=", "jinja2"), ("field_id", "=", body_type.id)]
)
jinja.write({"value": "qweb"})

View File

@ -0,0 +1,3 @@
# Copyright 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import mail_template

View File

@ -0,0 +1,49 @@
# Copyright 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import fields, models, tools
class MailTemplate(models.Model):
_inherit = "mail.template"
body_type = fields.Selection(
[("qweb", "QWeb"), ("qweb_view", "QWeb View")],
"Body templating engine",
default="qweb",
required=True,
)
body_view_id = fields.Many2one("ir.ui.view", domain=[("type", "=", "qweb")])
body_view_arch = fields.Text(related="body_view_id.arch")
def generate_email(self, res_ids, fields):
multi_mode = True
if isinstance(res_ids, int):
res_ids = [res_ids]
multi_mode = False
result = super(MailTemplate, self).generate_email(res_ids, fields=fields)
for lang, (_template, _template_res_ids) in self._classify_per_lang(
res_ids
).items():
self_with_lang = self.with_context(lang=lang)
for res_id in res_ids:
if self.body_type == "qweb_view" and (
not fields or "body_html" in fields
):
for record in self_with_lang.env[self.model].browse(res_id):
body_html = self_with_lang.body_view_id._render(
{"object": record, "email_template": self_with_lang}
)
# Some wizards, like when sending a sales order, need this
# fix to display accents correctly
body_html = tools.ustr(body_html)
result[res_id][
"body_html"
] = self_with_lang._render_template_postprocess(
{res_id: body_html}
)[
res_id
]
result[res_id]["body"] = tools.html_sanitize(
result[res_id]["body_html"]
)
return result if multi_mode else result[res_ids[0]]

View File

@ -0,0 +1,12 @@
* Holger Brunn <hbrunn@therp.nl>
* Dave Lasley <dave@laslabs.com>
* Carlos Lopez Mite <celm1990@gmail.com>
* `Tecnativa <https://www.tecnativa.com>`_:
* Ernesto Tejeda
* Thomas Fossoul (thomas@niboo.com)
* Phuc Tran Thanh <phuc@trobz.com>
* Foram Shah <foram.shah@initos.com>
* `Trobz <https://trobz.com>`_:
* Dzung Tran <dungtd@trobz.com>

View File

@ -0,0 +1,3 @@
The development of this module has been financially supported by:
* Camptocamp

View File

@ -0,0 +1,5 @@
This module was written to allow you to write email templates in `QWeb view` instead
of QWeb. The advantage here is that with QWeb View, you can make use of
inheritance and the ``call`` statement, which allows you to reuse designs and
snippets in multiple templates, making your development process simpler.
Furthermore, QWeb views are easier to edit with the integrated ACE editor.

View File

@ -0,0 +1,5 @@
To use this module, you need to:
#. Select `QWeb View` in the field `Body templating engine`
#. Select a `QWeb View` to be used to render the body field
#. Apart from `QWeb View` standard variables, you also have access to ``object`` and ``email_template``, which are browse records of the current object and the email template in use, respectively.

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -0,0 +1,467 @@
<?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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: http://docutils.sourceforge.net/" />
<title>QWeb for email templates</title>
<style type="text/css">
/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 7952 2016-07-26 18:15:59Z milde $
:Copyright: This stylesheet has been placed in the public domain.
Default cascading style sheet for the HTML output of Docutils.
See http://docutils.sf.net/docs/howto/html-stylesheets.html for how to
customize this style sheet.
*/
/* used to remove borders from tables and images */
.borderless, table.borderless td, table.borderless th {
border: 0 }
table.borderless td, table.borderless th {
/* Override padding for "table.docutils td" with "! important".
The right padding separates the table cells. */
padding: 0 0.5em 0 0 ! important }
.first {
/* Override more specific margin styles with "! important". */
margin-top: 0 ! important }
.last, .with-subtitle {
margin-bottom: 0 ! important }
.hidden {
display: none }
.subscript {
vertical-align: sub;
font-size: smaller }
.superscript {
vertical-align: super;
font-size: smaller }
a.toc-backref {
text-decoration: none ;
color: black }
blockquote.epigraph {
margin: 2em 5em ; }
dl.docutils dd {
margin-bottom: 0.5em }
object[type="image/svg+xml"], object[type="application/x-shockwave-flash"] {
overflow: hidden;
}
/* Uncomment (and remove this text!) to get bold-faced definition list terms
dl.docutils dt {
font-weight: bold }
*/
div.abstract {
margin: 2em 5em }
div.abstract p.topic-title {
font-weight: bold ;
text-align: center }
div.admonition, div.attention, div.caution, div.danger, div.error,
div.hint, div.important, div.note, div.tip, div.warning {
margin: 2em ;
border: medium outset ;
padding: 1em }
div.admonition p.admonition-title, div.hint p.admonition-title,
div.important p.admonition-title, div.note p.admonition-title,
div.tip p.admonition-title {
font-weight: bold ;
font-family: sans-serif }
div.attention p.admonition-title, div.caution p.admonition-title,
div.danger p.admonition-title, div.error p.admonition-title,
div.warning p.admonition-title, .code .error {
color: red ;
font-weight: bold ;
font-family: sans-serif }
/* Uncomment (and remove this text!) to get reduced vertical space in
compound paragraphs.
div.compound .compound-first, div.compound .compound-middle {
margin-bottom: 0.5em }
div.compound .compound-last, div.compound .compound-middle {
margin-top: 0.5em }
*/
div.dedication {
margin: 2em 5em ;
text-align: center ;
font-style: italic }
div.dedication p.topic-title {
font-weight: bold ;
font-style: normal }
div.figure {
margin-left: 2em ;
margin-right: 2em }
div.footer, div.header {
clear: both;
font-size: smaller }
div.line-block {
display: block ;
margin-top: 1em ;
margin-bottom: 1em }
div.line-block div.line-block {
margin-top: 0 ;
margin-bottom: 0 ;
margin-left: 1.5em }
div.sidebar {
margin: 0 0 0.5em 1em ;
border: medium outset ;
padding: 1em ;
background-color: #ffffee ;
width: 40% ;
float: right ;
clear: right }
div.sidebar p.rubric {
font-family: sans-serif ;
font-size: medium }
div.system-messages {
margin: 5em }
div.system-messages h1 {
color: red }
div.system-message {
border: medium outset ;
padding: 1em }
div.system-message p.system-message-title {
color: red ;
font-weight: bold }
div.topic {
margin: 2em }
h1.section-subtitle, h2.section-subtitle, h3.section-subtitle,
h4.section-subtitle, h5.section-subtitle, h6.section-subtitle {
margin-top: 0.4em }
h1.title {
text-align: center }
h2.subtitle {
text-align: center }
hr.docutils {
width: 75% }
img.align-left, .figure.align-left, object.align-left, table.align-left {
clear: left ;
float: left ;
margin-right: 1em }
img.align-right, .figure.align-right, object.align-right, table.align-right {
clear: right ;
float: right ;
margin-left: 1em }
img.align-center, .figure.align-center, object.align-center {
display: block;
margin-left: auto;
margin-right: auto;
}
table.align-center {
margin-left: auto;
margin-right: auto;
}
.align-left {
text-align: left }
.align-center {
clear: both ;
text-align: center }
.align-right {
text-align: right }
/* reset inner alignment in figures */
div.align-right {
text-align: inherit }
/* div.align-center * { */
/* text-align: left } */
.align-top {
vertical-align: top }
.align-middle {
vertical-align: middle }
.align-bottom {
vertical-align: bottom }
ol.simple, ul.simple {
margin-bottom: 1em }
ol.arabic {
list-style: decimal }
ol.loweralpha {
list-style: lower-alpha }
ol.upperalpha {
list-style: upper-alpha }
ol.lowerroman {
list-style: lower-roman }
ol.upperroman {
list-style: upper-roman }
p.attribution {
text-align: right ;
margin-left: 50% }
p.caption {
font-style: italic }
p.credits {
font-style: italic ;
font-size: smaller }
p.label {
white-space: nowrap }
p.rubric {
font-weight: bold ;
font-size: larger ;
color: maroon ;
text-align: center }
p.sidebar-title {
font-family: sans-serif ;
font-weight: bold ;
font-size: larger }
p.sidebar-subtitle {
font-family: sans-serif ;
font-weight: bold }
p.topic-title {
font-weight: bold }
pre.address {
margin-bottom: 0 ;
margin-top: 0 ;
font: inherit }
pre.literal-block, pre.doctest-block, pre.math, pre.code {
margin-left: 2em ;
margin-right: 2em }
pre.code .ln { color: grey; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
pre.code .literal.string, code .literal.string { color: #0C5404 }
pre.code .name.builtin, code .name.builtin { color: #352B84 }
pre.code .deleted, code .deleted { background-color: #DEB0A1}
pre.code .inserted, code .inserted { background-color: #A3D289}
span.classifier {
font-family: sans-serif ;
font-style: oblique }
span.classifier-delimiter {
font-family: sans-serif ;
font-weight: bold }
span.interpreted {
font-family: sans-serif }
span.option {
white-space: nowrap }
span.pre {
white-space: pre }
span.problematic {
color: red }
span.section-subtitle {
/* font-size relative to parent (h1..h6 element) */
font-size: 80% }
table.citation {
border-left: solid 1px gray;
margin-left: 1px }
table.docinfo {
margin: 2em 4em }
table.docutils {
margin-top: 0.5em ;
margin-bottom: 0.5em }
table.footnote {
border-left: solid 1px black;
margin-left: 1px }
table.docutils td, table.docutils th,
table.docinfo td, table.docinfo th {
padding-left: 0.5em ;
padding-right: 0.5em ;
vertical-align: top }
table.docutils th.field-name, table.docinfo th.docinfo-name {
font-weight: bold ;
text-align: left ;
white-space: nowrap ;
padding-left: 0 }
/* "booktabs" style (no vertical lines) */
table.docutils.booktabs {
border: 0px;
border-top: 2px solid;
border-bottom: 2px solid;
border-collapse: collapse;
}
table.docutils.booktabs * {
border: 0px;
}
table.docutils.booktabs th {
border-bottom: thin solid;
text-align: left;
}
h1 tt.docutils, h2 tt.docutils, h3 tt.docutils,
h4 tt.docutils, h5 tt.docutils, h6 tt.docutils {
font-size: 100% }
ul.auto-toc {
list-style-type: none }
</style>
</head>
<body>
<div class="document" id="qweb-for-email-templates">
<h1 class="title">QWeb for email templates</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/15.0/email_template_qweb"><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-email_template_qweb"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runboat.odoo-community.org/webui/builds.html?repo=OCA/social&amp;target_branch=15.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>This module was written to allow you to write email templates in <cite>QWeb view</cite> instead
of QWeb. The advantage here is that with QWeb View, you can make use of
inheritance and the <tt class="docutils literal">call</tt> statement, which allows you to reuse designs and
snippets in multiple templates, making your development process simpler.
Furthermore, QWeb views are easier to edit with the integrated ACE editor.</p>
<p><strong>Table of contents</strong></p>
<div class="contents local topic" id="contents">
<ul class="simple">
<li><a class="reference internal" href="#usage" id="id1">Usage</a></li>
<li><a class="reference internal" href="#bug-tracker" id="id2">Bug Tracker</a></li>
<li><a class="reference internal" href="#credits" id="id3">Credits</a><ul>
<li><a class="reference internal" href="#authors" id="id4">Authors</a></li>
<li><a class="reference internal" href="#contributors" id="id5">Contributors</a></li>
<li><a class="reference internal" href="#other-credits" id="id6">Other credits</a></li>
<li><a class="reference internal" href="#maintainers" id="id7">Maintainers</a></li>
</ul>
</li>
</ul>
</div>
<div class="section" id="usage">
<h1><a class="toc-backref" href="#id1">Usage</a></h1>
<p>To use this module, you need to:</p>
<ol class="arabic simple">
<li>Select <cite>QWeb View</cite> in the field <cite>Body templating engine</cite></li>
<li>Select a <cite>QWeb View</cite> to be used to render the body field</li>
<li>Apart from <cite>QWeb View</cite> standard variables, you also have access to <tt class="docutils literal">object</tt> and <tt class="docutils literal">email_template</tt>, which are browse records of the current object and the email template in use, respectively.</li>
</ol>
</div>
<div class="section" id="bug-tracker">
<h1><a class="toc-backref" href="#id2">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 smashing it by providing a detailed and welcomed
<a class="reference external" href="https://github.com/OCA/social/issues/new?body=module:%20email_template_qweb%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">
<h1><a class="toc-backref" href="#id3">Credits</a></h1>
<div class="section" id="authors">
<h2><a class="toc-backref" href="#id4">Authors</a></h2>
<ul class="simple">
<li>Therp BV</li>
</ul>
</div>
<div class="section" id="contributors">
<h2><a class="toc-backref" href="#id5">Contributors</a></h2>
<ul>
<li><p class="first">Holger Brunn &lt;<a class="reference external" href="mailto:hbrunn&#64;therp.nl">hbrunn&#64;therp.nl</a>&gt;</p>
</li>
<li><p class="first">Dave Lasley &lt;<a class="reference external" href="mailto:dave&#64;laslabs.com">dave&#64;laslabs.com</a>&gt;</p>
</li>
<li><p class="first">Carlos Lopez Mite &lt;<a class="reference external" href="mailto:celm1990&#64;gmail.com">celm1990&#64;gmail.com</a>&gt;</p>
</li>
<li><p class="first"><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:</p>
<blockquote>
<ul class="simple">
<li>Ernesto Tejeda</li>
</ul>
</blockquote>
</li>
<li><p class="first">Thomas Fossoul (<a class="reference external" href="mailto:thomas&#64;niboo.com">thomas&#64;niboo.com</a>)</p>
</li>
<li><p class="first">Phuc Tran Thanh &lt;<a class="reference external" href="mailto:phuc&#64;trobz.com">phuc&#64;trobz.com</a>&gt;</p>
</li>
<li><p class="first">Foram Shah &lt;<a class="reference external" href="mailto:foram.shah&#64;initos.com">foram.shah&#64;initos.com</a>&gt;</p>
</li>
<li><dl class="first docutils">
<dt><a class="reference external" href="https://trobz.com">Trobz</a>:</dt>
<dd><ul class="first last simple">
<li>Dzung Tran &lt;<a class="reference external" href="mailto:dungtd&#64;trobz.com">dungtd&#64;trobz.com</a>&gt;</li>
</ul>
</dd>
</dl>
</li>
</ul>
</div>
<div class="section" id="other-credits">
<h2><a class="toc-backref" href="#id6">Other credits</a></h2>
<p>The development of this module has been financially supported by:</p>
<ul class="simple">
<li>Camptocamp</li>
</ul>
</div>
<div class="section" id="maintainers">
<h2><a class="toc-backref" href="#id7">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
<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/15.0/email_template_qweb">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>
</div>
</body>
</html>

View File

@ -0,0 +1,3 @@
# Copyright 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from . import test_mail_template_qweb

View File

@ -0,0 +1,23 @@
# Copyright 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import TransactionCase
class TestMailTemplateQweb(TransactionCase):
def test_email_template_qweb(self):
template = self.env.ref("email_template_qweb.email_template_demo1")
mail_values = template.generate_email([self.env.user.id], ["body_html"])
self.assertTrue(
# this comes from the called template if everything worked
"<footer>" in mail_values[self.env.user.id]["body_html"],
"Did not receive rendered template in response. Got: \n%s\n"
% (mail_values[self.env.user.id]["body_html"]),
)
# the same method is also called in a non multi mode
mail_values = template.generate_email(self.env.user.id, ["body_html"])
self.assertTrue(
# this comes from the called template if everything worked
"<footer>" in mail_values["body_html"],
"Did not receive rendered template in response. Got: \n%s\n"
% (mail_values["body_html"]),
)

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="email_template_form" model="ir.ui.view">
<field name="model">mail.template</field>
<field name="inherit_id" ref="mail.email_template_form" />
<field name="arch" type="xml">
<field name="model_id" position="after">
<field name="body_type" />
</field>
<field name="body_html" position="before">
<group attrs="{'invisible': [('body_type', '!=', 'qweb_view')]}">
<field
name="body_view_id"
attrs="{'required': [('body_type', '=', 'qweb_view')]}"
/>
<field
name="body_view_arch"
widget="ace"
attrs="{'required': [('body_type', '=', 'qweb_view')], 'invisible': [('body_view_id', '=', False)]}"
/>
</group>
</field>
<field name="body_html" position="attributes">
<attribute
name="attrs"
>{'invisible': [('body_type', '!=', 'qweb')]}</attribute>
</field>
</field>
</record>
<record id="email_template_tree" model="ir.ui.view">
<field name="model">mail.template</field>
<field name="inherit_id" ref="mail.email_template_tree" />
<field name="arch" type="xml">
<field name="report_name" position="before">
<field name="body_type" />
</field>
</field>
</record>
</odoo>

View File

@ -0,0 +1 @@
../../../../email_template_qweb

View File

@ -0,0 +1,6 @@
import setuptools
setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)