From dc8996ebe84a70a3607703a3b933a132a6fa0330 Mon Sep 17 00:00:00 2001 From: Sergio Teruel Albert Date: Mon, 13 Jun 2016 01:54:13 +0200 Subject: [PATCH] [MIG][9.0] mail_attach_existing_attachment: Module migrated (#68) * [MIG][9.0] mail_attach_existing_attachment: Module migrated --- mail_attach_existing_attachment/README.rst | 13 +++++++------ .../__openerp__.py | 8 +++++--- .../static/description/icon.png | Bin 0 -> 4773 bytes .../test_mail_attach_existing_attachment.py | 2 +- .../wizard/mail_compose_message.py | 18 +++++++----------- 5 files changed, 20 insertions(+), 21 deletions(-) create mode 100644 mail_attach_existing_attachment/static/description/icon.png 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 2e5f1c74..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,5 +40,5 @@ 'data': [ 'wizard/mail_compose_message_view.xml', ], - 'installable': False, + '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 0000000000000000000000000000000000000000..0b6c4d89568d7aea4498047e6edcca8b53014538 GIT binary patch literal 4773 zcmV;W5?bwvP)MAP;;T3dIkwrls%Pvw2 zE+UAlmLTF=QCJjM3J7K;B@5^-R3V^fFbNvK5g8DYKwk5>r}vLOcjnHW(>F88%-q*G zRZ|q-oO@1pfBSTQ``5qUuOYj#E4#8QyRs|0n*CDpmtoC=Vab1^KUS?|crpFh7n!85D@F(6+$9Vly{=D~V;dfGzMLDoRc zhh>eCkq=QaEMyJTJXj_In;9b$fz6ARi@+0&7v2o+Z-GJG^EHm1{ zTH-i%z#xDb2A0dPs$yG!=YYQeee>tfA1LQCh2P;0koJ%Jo7v(xj^7F#0PG^ERYJ}o z=bQtOgajE@bu0!3BwmoTGLGFnz#YJ<5cweyINOYK&Gd+*ArcFcBxhz$lFP8Vz=nWF z%($Sft!=@0Mc`{C-C(A{tRWi((~!hXz+u}Gfrm?4ku_SwV!r_184`hiC+R9l?{dzO zOfktEBb>iB0UIO@d5F^clwnoJa?ZJKpi3p-Xf9b1$L>7f(bD0+L*mQ;`OZ1_m~(C! za6izS&*ujR1_lOzLh_7!KA+EJSXHsXWLRGayj9|8=iGtLIhB3LM*yDy&IUFYJHd%& zdO2nI7?5-|a8NQ*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2~ zV{VpnuDeX!&A{hSyaVVjX@fPu?`$w8wY^n6ly*yqoZz8*z<0PoV>1MHnx z+7>2)cR>wcd*i*A?@y`6Uw}i(4R#V&rs#k*#Rl41A_9v(`IjX-UyVfmJmBttB3_;x zTGd)dbvxP2%B-+#iK6J36diDOvLRPm=hej<9xl@X&P>ljZ6rCIL~LnV3U^?6E|+^< zz11zB&mSc5XU2MT9hdUkk1!l=KP&?OSiI??snlwo_oaQ#;mAGk0yG)ioUB7GNF4D6N+k?qNHqv++DuLJA=Gp$a^ zF?cQ8nM!7tU3S?C@03~o-s!;h#=C!&hn+oxSN-K>K37tqjNgY~B$3gF%ygA=EJ)c? z#yPhh_@hLxnfeO_SJVnfU?wXRoN5)5G}Aebbk5~U)c$74om?nzO9|2AT2Vw%^!`Gj z@D7s9BguQCLcvj1mZ`vUzya(Egj{@`edpWs848hJEW3+yvN;njxs zv8$ze#K5ijeEu~7opLQ>w}aQ>;|NAwr4^q6oaA?#^w(0C;>PI^Jd@Ao57`bSew3uu zHBgViWGQ!L54h@TU$LQp2+9(2jMe}JW6<(cuNvio@+YtORy!ty1=TSSJHLBv598blkvyk??xi_bguS5jqpL*)4AsWN!qY{>r_;*R?Ifn(z-kb400|OE` zhg@=FVnVJ3ERxhI(d8U1fqE1l@9wgMX^J!__iCBB{1VK2siUQ$zvz#!J$-QBfe z!-ie)ZsWTGU1pYpcrcDf;`7bSs*Dxz?p>R6x!j9GLqolI1JBR|>f5{`FvBtt*wk1i z0y8WVff+XX8t-;+hBXdWOhn~xAQOR2D+2!?_@P|k^Bn>O00000NkvXXu0mjfW-}A~ literal 0 HcmV?d00001 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