diff --git a/addons/sale/wizard/sale_order_cancel.py b/addons/sale/wizard/sale_order_cancel.py index ac4eb391f90..96f1c55633a 100644 --- a/addons/sale/wizard/sale_order_cancel.py +++ b/addons/sale/wizard/sale_order_cancel.py @@ -60,26 +60,23 @@ class SaleOrderCancel(models.TransientModel): @api.depends('order_id') def _compute_subject(self): - for wizard in self: - if wizard.template_id: - wizard.subject = self.sudo()._render_template( - wizard.template_id.subject, - 'sale.order', - [wizard.order_id.id], - options={'post_process': True}, - )[wizard.order_id.id] + for wizard_su in self.filtered('template_id').sudo(): + wizard_su.subject = wizard_su.template_id._render_field( + 'subject', + [wizard_su.order_id.id], + compute_lang=True, + options={'post_process': True}, + )[wizard_su.order_id.id] @api.depends('order_id') def _compute_body(self): - for wizard in self: - if wizard.template_id: - wizard.body = self.sudo()._render_template( - wizard.template_id.body_html, - 'sale.order', - [wizard.order_id.id], - options={'post_process': True}, - engine='qweb', - )[wizard.order_id.id] + for wizard_su in self.filtered('template_id').sudo(): + wizard_su.body = wizard_su.template_id._render_field( + 'body_html', + [wizard_su.order_id.id], + compute_lang=True, + options={'post_process': True}, + )[wizard_su.order_id.id] def action_send_mail_and_cancel(self): self.ensure_one()