Browse Source
Merge pull request #147 from acsone/10.0-mail-attach-inheritance-ape
[mail_attach_existing_attachment][IMP] Move domain in python in order to allow inheritance
pull/302/head
Pedro M. Baeza
6 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
7 additions and
2 deletions
-
mail_attach_existing_attachment/wizard/mail_compose_message.py
-
mail_attach_existing_attachment/wizard/mail_compose_message_view.xml
|
|
@ -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): |
|
|
|
|
|
@ -9,7 +9,7 @@ |
|
|
|
<field name="can_attach_attachment" invisible="1"/> |
|
|
|
<div attrs="{'invisible': [('can_attach_attachment', '=', False)]}"> |
|
|
|
<br /> |
|
|
|
<field name="object_attachment_ids" widget="many2many_checkboxes" domain="[('res_model', '=', model), ('res_id', '=', res_id)]" /> |
|
|
|
<field name="object_attachment_ids" widget="many2many_checkboxes" /> |
|
|
|
</div> |
|
|
|
</xpath> |
|
|
|
</field> |
|
|
|