[MIG][9.0] mail_attach_existing_attachment: Module migrated (#68)

* [MIG][9.0] mail_attach_existing_attachment: Module migrated
pull/594/head
Sergio Teruel Albert 2016-06-13 01:54:13 +02:00 committed by Radovan Skolnik
parent 586e10bfe9
commit e15a92b00f
5 changed files with 20 additions and 20 deletions

View File

@ -31,7 +31,7 @@ To configure this module, you need to:
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot :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 Known issues / Roadmap
====================== ======================
@ -41,10 +41,10 @@ Known issues / Roadmap
Bug Tracker Bug Tracker
=========== ===========
Bugs are tracked on `GitHub Issues <https://github.com/OCA/social/issues>`_. Bugs are tracked on `GitHub Issues
In case of trouble, please check there if your issue has already been reported. <https://github.com/OCA/social/issues>`_. In case of trouble, please
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback check there if your issue has already been reported. If you spotted it first,
`here <https://github.com/OCA/social/issues/new?body=module:%20mail_attach_existing_attachment%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. help us smashing it by providing a detailed and welcomed feedback.
Credits Credits
======= =======
@ -53,6 +53,7 @@ Contributors
------------ ------------
* Adrien Peiffer <adrien.peiffer@acsone.eu> * Adrien Peiffer <adrien.peiffer@acsone.eu>
* Sergio Teruel <sergio.teruel@tecnativa.com>
Maintainer Maintainer
---------- ----------

View File

@ -26,10 +26,12 @@
'name': "Mail Attach Existing Attachment", 'name': "Mail Attach Existing Attachment",
'summary': """ 'summary': """
Adding attachment on the object by sending this one""", 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", 'website': "http://acsone.eu",
'category': 'Social Network', 'category': 'Social Network',
'version': '8.0.1.0.0', 'version': '9.0.1.0.0',
'license': 'AGPL-3', 'license': 'AGPL-3',
'depends': [ 'depends': [
'mail', 'mail',
@ -38,4 +40,5 @@
'data': [ 'data': [
'wizard/mail_compose_message_view.xml', 'wizard/mail_compose_message_view.xml',
], ],
'installable': True,
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -44,6 +44,6 @@ class TestAttachExistingAttachment(common.TransactionCase):
'object_attachment_ids': [(6, 0, [attach1.id])] 'object_attachment_ids': [(6, 0, [attach1.id])]
} }
mail = self.env['mail.compose.message'].create(vals) 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 self.assertTrue(attach1.id in
values[self.partner_01.id]['attachment_ids']) values[self.partner_01.id]['attachment_ids'])

View File

@ -35,7 +35,7 @@ class MailComposeMessage(models.TransientModel):
if res.get('res_id') and res.get('model') and \ if res.get('res_id') and res.get('model') and \
res.get('composition_mode', '') != 'mass_mail' and\ res.get('composition_mode', '') != 'mass_mail' and\
not res.get('can_attach_attachment'): not res.get('can_attach_attachment'):
res['can_attach_attachment'] = True res['can_attach_attachment'] = True # pragma: no cover
return res return res
can_attach_attachment = fields.Boolean(string='Can Attach Attachment') 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', relation='mail_compose_message_ir_attachments_object_rel',
column1='wizard_id', column2='attachment_id', string='Attachments') column1='wizard_id', column2='attachment_id', string='Attachments')
@api.model @api.multi
def get_mail_values(self, wizard, res_ids): def get_mail_values(self, res_ids):
res = super(MailComposeMessage, self).get_mail_values(wizard, res_ids) res = super(MailComposeMessage, self).get_mail_values(res_ids)
if wizard.object_attachment_ids.ids and wizard.model and\ if self.object_attachment_ids.ids and self.model and len(res_ids) == 1:
len(res_ids) == 1: res[res_ids[0]].setdefault('attachment_ids', []).extend(
for res_id in res_ids: self.object_attachment_ids.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)
return res return res