Skip to content

Commit

Permalink
Merge PR #1072 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by hbrunn
  • Loading branch information
OCA-git-bot committed Mar 20, 2023
2 parents 607f2f5 + 71fdbcb commit ff22f48
Show file tree
Hide file tree
Showing 30 changed files with 1,719 additions and 0 deletions.
104 changes: 104 additions & 0 deletions email_template_qweb/README.rst
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 3 additions & 0 deletions email_template_qweb/__init__.py
Original file line number Diff line number Diff line change
@@ -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
15 changes: 15 additions & 0 deletions email_template_qweb/__manifest__.py
Original file line number Diff line number Diff line change
@@ -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,
}
42 changes: 42 additions & 0 deletions email_template_qweb/demo/ir_ui_view.xml
Original file line number Diff line number Diff line change
@@ -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>
10 changes: 10 additions & 0 deletions email_template_qweb/demo/mail_template.xml
Original file line number Diff line number Diff line change
@@ -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>
80 changes: 80 additions & 0 deletions email_template_qweb/i18n/de.po
Original file line number Diff line number Diff line change
@@ -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"
81 changes: 81 additions & 0 deletions email_template_qweb/i18n/email_template_qweb.pot
Original file line number Diff line number Diff line change
@@ -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 ""
Loading

0 comments on commit ff22f48

Please sign in to comment.