Browse Source

Merge pull request #250 from celm1990/11.0-mig-email_template_qweb

[11][MIG] email_template_qweb: Migration to 11.0
pull/280/head
Pedro M. Baeza 7 years ago
committed by GitHub
parent
commit
057aa7bb65
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 65
      email_template_qweb/README.rst
  2. 3
      email_template_qweb/__init__.py
  3. 22
      email_template_qweb/__manifest__.py
  4. 39
      email_template_qweb/demo/ir_ui_view.xml
  5. 10
      email_template_qweb/demo/mail_template.xml
  6. 69
      email_template_qweb/i18n/de.po
  7. 63
      email_template_qweb/i18n/en.po
  8. 69
      email_template_qweb/i18n/es.po
  9. 74
      email_template_qweb/i18n/es_MX.po
  10. 69
      email_template_qweb/i18n/fr.po
  11. 69
      email_template_qweb/i18n/hr.po
  12. 70
      email_template_qweb/i18n/it.po
  13. 69
      email_template_qweb/i18n/nl_NL.po
  14. 69
      email_template_qweb/i18n/pt_BR.po
  15. 64
      email_template_qweb/i18n/zh_CN.po
  16. 3
      email_template_qweb/models/__init__.py
  17. 42
      email_template_qweb/models/mail_template.py
  18. BIN
      email_template_qweb/static/description/icon.png
  19. 3
      email_template_qweb/tests/__init__.py
  20. 25
      email_template_qweb/tests/test_mail_template_qweb.py
  21. 30
      email_template_qweb/views/mail_template.xml

65
email_template_qweb/README.rst

@ -0,0 +1,65 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3
========================
QWeb for email templates
========================
This module was written to allow you to write email templates in QWeb instead
of jinja2. The advantage here is that with QWeb, 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.
Usage
=====
To use this module, you need to:
#. Select `QWeb` in the field `Body templating engine`
#. Select a QWeb view to be used to render the body field
#. Apart from QWeb's 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.
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/205/11.0
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 smash it by providing detailed and welcomed feedback.
Credits
=======
Images
------
* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
Contributors
------------
* Holger Brunn <hbrunn@therp.nl>
* Dave Lasley <dave@laslabs.com>
* Carlos Lopez Mite <celm1990@gmail.com>
Do not contact contributors directly about support or help with technical issues.
Maintainer
----------
.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org
This module is maintained by the OCA.
OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.
To contribute to this module, please visit https://odoo-community.org.

3
email_template_qweb/__init__.py

@ -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

22
email_template_qweb/__manifest__.py

@ -0,0 +1,22 @@
# 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": "11.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,
}

39
email_template_qweb/demo/ir_ui_view.xml

@ -0,0 +1,39 @@
<?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-raw="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-raw="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>

10
email_template_qweb/demo/mail_template.xml

@ -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</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>

69
email_template_qweb/i18n/de.po

@ -0,0 +1,69 @@
# 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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: de\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_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: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 "Nachrichtenansicht"
#. module: email_template_qweb
#: model: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
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
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.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"

63
email_template_qweb/i18n/en.po

@ -0,0 +1,63 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * email_template_qweb
#
# Translators:
msgid ""
msgstr ""
"Project-Id-Version: social (9.0)\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-05-19 02:50+0000\n"
"PO-Revision-Date: 2016-05-18 14:54+0000\n"
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
"Language-Team: English (http://www.transifex.com/oca/OCA-social-9-0/language/en/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: en\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template_body_type
msgid "Body templating engine"
msgstr "Body templating engine"
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template_body_view_id
msgid "Body view"
msgstr "Body view"
#. module: email_template_qweb
#: model:ir.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "Dear"
msgstr "Dear"
#. module: email_template_qweb
#: model:ir.model,name:email_template_qweb.model_mail_template
msgid "Email Templates"
msgstr "Email Templates"
#. module: email_template_qweb
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: selection:mail.template,body_type:0
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.ui.view,arch_db:email_template_qweb.view_email_template_demo1
msgid "This is an email template using qweb."
msgstr "This is an email template using qweb."
#. module: email_template_qweb
#: model:ir.model.fields,field_description:email_template_qweb.field_mail_template_body_view_arch
msgid "View Architecture"
msgstr "View Architecture"

69
email_template_qweb/i18n/es.po

@ -0,0 +1,69 @@
# 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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es\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_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: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 "Vista del cuerpo"
#. module: email_template_qweb
#: model: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
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
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.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"

74
email_template_qweb/i18n/es_MX.po

@ -0,0 +1,74 @@
# 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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: es_MX\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_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: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 "Vista del cuerpo"
#. module: email_template_qweb
#: model: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_email_template_preview
msgid "Email Template Preview"
msgstr ""
#. 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
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
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.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 ""

69
email_template_qweb/i18n/fr.po

@ -0,0 +1,69 @@
# 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: 2017-07-22 09:45+0000\n"
"Last-Translator: Quentin THEURET <odoo@kerpeo.com>, 2017\n"
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: fr\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_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: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 "Vue du corps"
#. module: email_template_qweb
#: model: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
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
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.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"

69
email_template_qweb/i18n/hr.po

@ -0,0 +1,69 @@
# 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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: hr\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_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: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 "Pregled tijela"
#. module: email_template_qweb
#: model: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
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
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.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"

70
email_template_qweb/i18n/it.po

@ -0,0 +1,70 @@
# 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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: it\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_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: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 "Visualizzazione Messaggio"
#. module: email_template_qweb
#: model: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
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
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.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"

69
email_template_qweb/i18n/nl_NL.po

@ -0,0 +1,69 @@
# 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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: nl_NL\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_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: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.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
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr "Jinja2"
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
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.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 ""

69
email_template_qweb/i18n/pt_BR.po

@ -0,0 +1,69 @@
# 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: 2017-07-22 00:50+0000\n"
"Last-Translator: falexandresilva <falexandresilva@gmail.com>, 2017\n"
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: pt_BR\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_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: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.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 ""
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr ""
#. module: email_template_qweb
#: selection:email_template.preview,body_type:0
#: selection:mail.template,body_type:0
msgid "QWeb"
msgstr "QWeb"
#. 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.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 ""

64
email_template_qweb/i18n/zh_CN.po

@ -0,0 +1,64 @@
# 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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#. 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:ir.model.fields,field_description:email_template_qweb.field_mail_template_body_view_id
msgid "Body view"
msgstr ""
#. module: email_template_qweb
#: model: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
#: selection:mail.template,body_type:0
msgid "Jinja2"
msgstr ""
#. module: email_template_qweb
#: selection:mail.template,body_type:0
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.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 ""

3
email_template_qweb/models/__init__.py

@ -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

42
email_template_qweb/models/mail_template.py

@ -0,0 +1,42 @@
# Copyright 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, tools, models
class MailTemplate(models.Model):
_inherit = 'mail.template'
body_type = fields.Selection(
[('jinja2', 'Jinja2'), ('qweb', 'QWeb')], 'Body templating engine',
default='jinja2', required=True)
body_view_id = fields.Many2one(
'ir.ui.view', 'Body view', domain=[('type', '=', 'qweb')])
body_view_arch = fields.Text(related='body_view_id.arch')
@api.multi
def generate_email(self, res_ids, fields=None):
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 res_id, template in self.get_email_template(res_ids).items():
if template.body_type == 'qweb' and\
(not fields or 'body_html' in fields):
for record in self.env[template.model].browse(res_id):
body_html = template.body_view_id.render({
'object': record,
'email_template': template,
})
# 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.render_post_process(
body_html
)
result[res_id]['body'] = tools.html_sanitize(
result[res_id]['body_html']
)
return multi_mode and result or result[res_ids[0]]

BIN
email_template_qweb/static/description/icon.png

After

Width: 128  |  Height: 128  |  Size: 9.2 KiB

3
email_template_qweb/tests/__init__.py

@ -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

25
email_template_qweb/tests/test_mail_template_qweb.py

@ -0,0 +1,25 @@
# 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])
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)
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']
)
)

30
email_template_qweb/views/mail_template.xml

@ -0,0 +1,30 @@
<?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')]}">
<field name="body_view_id" attrs="{'required': [('body_type', '=', 'qweb')]}" />
<field name="body_view_arch" widget="ace" attrs="{'required': [('body_type', '=', 'qweb')], 'invisible': [('body_view_id', '=', False)]}" />
</group>
</field>
<field name="body_html" position="attributes">
<attribute name="attrs">{'invisible': [('body_type', '!=', 'jinja2')]}</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>
Loading…
Cancel
Save