[MIG] email_template_qweb: Migration to 13.0

pull/1072/head
tfo 2020-01-02 13:51:49 +01:00 committed by Dũng (Trần Đình)
parent 5382bde82c
commit d2697b507f
4 changed files with 8 additions and 7 deletions

View File

@ -73,6 +73,8 @@ Contributors
* Ernesto Tejeda * Ernesto Tejeda
* Thomas Fossoul (thomas@niboo.com)
Maintainers Maintainers
~~~~~~~~~~~ ~~~~~~~~~~~

View File

@ -2,7 +2,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{ {
"name": "QWeb for email templates", "name": "QWeb for email templates",
"version": "12.0.1.0.0", "version": "13.0.1.0.0",
"author": "Therp BV, Odoo Community Association (OCA)", "author": "Therp BV, Odoo Community Association (OCA)",
"license": "AGPL-3", "license": "AGPL-3",
"category": "Marketing", "category": "Marketing",

View File

@ -1,6 +1,6 @@
# Copyright 2016 Therp BV <http://therp.nl> # Copyright 2016 Therp BV <http://therp.nl>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models, tools from odoo import fields, models, tools
class MailTemplate(models.Model): class MailTemplate(models.Model):
@ -12,12 +12,9 @@ class MailTemplate(models.Model):
default="jinja2", default="jinja2",
required=True, required=True,
) )
body_view_id = fields.Many2one( body_view_id = fields.Many2one("ir.ui.view", domain=[("type", "=", "qweb")])
"ir.ui.view", "Body view", domain=[("type", "=", "qweb")]
)
body_view_arch = fields.Text(related="body_view_id.arch") body_view_arch = fields.Text(related="body_view_id.arch")
@api.multi
def generate_email(self, res_ids, fields=None): def generate_email(self, res_ids, fields=None):
multi_mode = True multi_mode = True
if isinstance(res_ids, int): if isinstance(res_ids, int):
@ -37,4 +34,4 @@ class MailTemplate(models.Model):
result[res_id]["body"] = tools.html_sanitize( result[res_id]["body"] = tools.html_sanitize(
result[res_id]["body_html"] result[res_id]["body_html"]
) )
return multi_mode and result or result[res_ids[0]] return result if multi_mode else result[res_ids[0]]

View File

@ -4,3 +4,5 @@
* `Tecnativa <https://www.tecnativa.com>`_: * `Tecnativa <https://www.tecnativa.com>`_:
* Ernesto Tejeda * Ernesto Tejeda
* Thomas Fossoul (thomas@niboo.com)