From e9e72fe5f149fec25108835fb71fac22aa579f80 Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Wed, 18 Jan 2017 10:37:54 +0100 Subject: [PATCH] [IMP] Move domain in python in order to allow inheritance --- .../wizard/mail_compose_message.py | 7 ++++++- .../wizard/mail_compose_message_view.xml | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mail_attach_existing_attachment/wizard/mail_compose_message.py b/mail_attach_existing_attachment/wizard/mail_compose_message.py index a86e4a80..91d6004a 100644 --- a/mail_attach_existing_attachment/wizard/mail_compose_message.py +++ b/mail_attach_existing_attachment/wizard/mail_compose_message.py @@ -38,11 +38,16 @@ class MailComposeMessage(models.TransientModel): res['can_attach_attachment'] = True # pragma: no cover return res + @api.model + def _get_object_attachment_domain(self): + return "[('res_model', '=', model), ('res_id', '=', res_id)]" + can_attach_attachment = fields.Boolean(string='Can Attach Attachment') object_attachment_ids = fields.Many2many( comodel_name='ir.attachment', relation='mail_compose_message_ir_attachments_object_rel', - column1='wizard_id', column2='attachment_id', string='Attachments') + column1='wizard_id', column2='attachment_id', string='Attachments', + domain=lambda self: self._get_object_attachment_domain()) @api.multi def get_mail_values(self, res_ids): diff --git a/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml b/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml index d79a0342..b347dcd4 100644 --- a/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml +++ b/mail_attach_existing_attachment/wizard/mail_compose_message_view.xml @@ -9,7 +9,7 @@

- +