diff --git a/mail_attach_existing_attachment/README.rst b/mail_attach_existing_attachment/README.rst index 50784be0..d81fb587 100644 --- a/mail_attach_existing_attachment/README.rst +++ b/mail_attach_existing_attachment/README.rst @@ -31,7 +31,7 @@ To configure this module, you need to: .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/205/8.0 + :target: https://runbot.odoo-community.org/runbot/205/9.0 Known issues / Roadmap ====================== @@ -41,10 +41,10 @@ Known issues / Roadmap Bug Tracker =========== -Bugs are tracked on `GitHub Issues `_. -In case of trouble, please check there if your issue has already been reported. -If you spotted it first, help us smashing it by providing a detailed and welcomed feedback -`here `_. +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smashing it by providing a detailed and welcomed feedback. Credits ======= @@ -53,6 +53,7 @@ Contributors ------------ * Adrien Peiffer +* Sergio Teruel Maintainer ---------- @@ -65,4 +66,4 @@ This module is maintained by the OCA. OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. -To contribute to this module, please visit http://odoo-community.org. \ No newline at end of file +To contribute to this module, please visit http://odoo-community.org. diff --git a/mail_attach_existing_attachment/__openerp__.py b/mail_attach_existing_attachment/__openerp__.py index 7ec7bbb6..58f1642d 100644 --- a/mail_attach_existing_attachment/__openerp__.py +++ b/mail_attach_existing_attachment/__openerp__.py @@ -26,10 +26,12 @@ 'name': "Mail Attach Existing Attachment", 'summary': """ Adding attachment on the object by sending this one""", - 'author': "ACSONE SA/NV,Odoo Community Association (OCA)", + 'author': "ACSONE SA/NV," + "Tecnativa," + "Odoo Community Association (OCA)", 'website': "http://acsone.eu", 'category': 'Social Network', - 'version': '8.0.1.0.0', + 'version': '9.0.1.0.0', 'license': 'AGPL-3', 'depends': [ 'mail', @@ -38,4 +40,5 @@ 'data': [ 'wizard/mail_compose_message_view.xml', ], + 'installable': True, } diff --git a/mail_attach_existing_attachment/static/description/icon.png b/mail_attach_existing_attachment/static/description/icon.png new file mode 100644 index 00000000..0b6c4d89 Binary files /dev/null and b/mail_attach_existing_attachment/static/description/icon.png differ diff --git a/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py b/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py index eed39bc3..af1aaaec 100644 --- a/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py +++ b/mail_attach_existing_attachment/tests/test_mail_attach_existing_attachment.py @@ -44,6 +44,6 @@ class TestAttachExistingAttachment(common.TransactionCase): 'object_attachment_ids': [(6, 0, [attach1.id])] } mail = self.env['mail.compose.message'].create(vals) - values = mail.get_mail_values(mail, [self.partner_01.id]) + values = mail.get_mail_values([self.partner_01.id]) self.assertTrue(attach1.id in values[self.partner_01.id]['attachment_ids']) diff --git a/mail_attach_existing_attachment/wizard/mail_compose_message.py b/mail_attach_existing_attachment/wizard/mail_compose_message.py index 4c7d43f3..6e154a14 100644 --- a/mail_attach_existing_attachment/wizard/mail_compose_message.py +++ b/mail_attach_existing_attachment/wizard/mail_compose_message.py @@ -35,7 +35,7 @@ class MailComposeMessage(models.TransientModel): if res.get('res_id') and res.get('model') and \ res.get('composition_mode', '') != 'mass_mail' and\ not res.get('can_attach_attachment'): - res['can_attach_attachment'] = True + res['can_attach_attachment'] = True # pragma: no cover return res can_attach_attachment = fields.Boolean(string='Can Attach Attachment') @@ -44,14 +44,10 @@ class MailComposeMessage(models.TransientModel): relation='mail_compose_message_ir_attachments_object_rel', column1='wizard_id', column2='attachment_id', string='Attachments') - @api.model - def get_mail_values(self, wizard, res_ids): - res = super(MailComposeMessage, self).get_mail_values(wizard, res_ids) - if wizard.object_attachment_ids.ids and wizard.model and\ - len(res_ids) == 1: - for res_id in res_ids: - if not res[res_id].get('attachment_ids'): - res[res_id]['attachment_ids'] = [] - res[res_id]['attachment_ids'].extend( - wizard.object_attachment_ids.ids) + @api.multi + def get_mail_values(self, res_ids): + res = super(MailComposeMessage, self).get_mail_values(res_ids) + if self.object_attachment_ids.ids and self.model and len(res_ids) == 1: + res[res_ids[0]].setdefault('attachment_ids', []).extend( + self.object_attachment_ids.ids) return res