diff --git a/mail_template_attach_existing_attachment/wizard/mail_compose_message.py b/mail_template_attach_existing_attachment/wizard/mail_compose_message.py index cf4d7b5e95..8db1dc1352 100644 --- a/mail_template_attach_existing_attachment/wizard/mail_compose_message.py +++ b/mail_template_attach_existing_attachment/wizard/mail_compose_message.py @@ -30,8 +30,8 @@ def _match_attachment(self, re_pattern, model, res_ids): ) ) - @api.onchange("template_id", "res_ids", "model") - def _compute_object_attachment_ids(self): + @api.depends("composition_mode", "model", "res_domain", "res_ids", "template_id") + def _compute_attachment_ids(self): for composer in self: composer.object_attachment_ids = self.env["ir.attachment"].browse() if ( @@ -43,8 +43,8 @@ def _compute_object_attachment_ids(self): pattern, composer.model, parse_res_ids(composer.res_ids) ) - def get_mail_values(self, res_ids): - res = super().get_mail_values(res_ids) + def _prepare_mail_values_dynamic(self, res_ids): + res = super()._prepare_mail_values_dynamic(res_ids) self.ensure_one() if ( self.template_id