From d2697b507ffaaefde087f0c3a6ab088dea2dd567 Mon Sep 17 00:00:00 2001 From: tfo Date: Thu, 2 Jan 2020 13:51:49 +0100 Subject: [PATCH] [MIG] email_template_qweb: Migration to 13.0 --- email_template_qweb/README.rst | 2 ++ email_template_qweb/__manifest__.py | 2 +- email_template_qweb/models/mail_template.py | 9 +++------ email_template_qweb/readme/CONTRIBUTORS.rst | 2 ++ 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/email_template_qweb/README.rst b/email_template_qweb/README.rst index bf3f6fd58..504379d8e 100644 --- a/email_template_qweb/README.rst +++ b/email_template_qweb/README.rst @@ -73,6 +73,8 @@ Contributors * Ernesto Tejeda +* Thomas Fossoul (thomas@niboo.com) + Maintainers ~~~~~~~~~~~ diff --git a/email_template_qweb/__manifest__.py b/email_template_qweb/__manifest__.py index 3d5244511..6fecc88b9 100644 --- a/email_template_qweb/__manifest__.py +++ b/email_template_qweb/__manifest__.py @@ -2,7 +2,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). { "name": "QWeb for email templates", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "author": "Therp BV, Odoo Community Association (OCA)", "license": "AGPL-3", "category": "Marketing", diff --git a/email_template_qweb/models/mail_template.py b/email_template_qweb/models/mail_template.py index a143e7590..f3adcdf16 100644 --- a/email_template_qweb/models/mail_template.py +++ b/email_template_qweb/models/mail_template.py @@ -1,6 +1,6 @@ # Copyright 2016 Therp BV # 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): @@ -12,12 +12,9 @@ class MailTemplate(models.Model): default="jinja2", required=True, ) - body_view_id = fields.Many2one( - "ir.ui.view", "Body view", domain=[("type", "=", "qweb")] - ) + body_view_id = fields.Many2one("ir.ui.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): @@ -37,4 +34,4 @@ class MailTemplate(models.Model): result[res_id]["body"] = tools.html_sanitize( 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]] diff --git a/email_template_qweb/readme/CONTRIBUTORS.rst b/email_template_qweb/readme/CONTRIBUTORS.rst index 2349a885d..e20e6e921 100644 --- a/email_template_qweb/readme/CONTRIBUTORS.rst +++ b/email_template_qweb/readme/CONTRIBUTORS.rst @@ -4,3 +4,5 @@ * `Tecnativa `_: * Ernesto Tejeda + +* Thomas Fossoul (thomas@niboo.com)