Kuldeep Joshi(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-bug-1096395-kjo into 
lp:openobject-addons.

Requested reviews:
  Atul Patel(OpenERP) (atp-openerp)
Related bugs:
  Bug #1096395 in OpenERP Addons: "[OpenERP V7] invoice duplicate attachments 
when sending via email"
  https://bugs.launchpad.net/openobject-addons/+bug/1096395

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1096395-kjo/+merge/142450

Remove the attachment from mail_message_common and done at message_post method
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-1096395-kjo/+merge/142450
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-bug-1096395-kjo.
=== modified file 'account/account_report.xml'
--- account/account_report.xml	2012-11-29 22:26:45 +0000
+++ account/account_report.xml	2013-01-09 07:33:24 +0000
@@ -19,7 +19,7 @@
             name="account.invoice"
             rml="account/report/account_print_invoice.rml"
             string="Invoices"
-            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
+            attachment="(object.state in ('open','paid')) and ('Invoice_'+(object.number or '').replace('/','_')+'_.pdf')"
             attachment_use="True"
             usage="default"
             />

=== modified file 'email_template/wizard/mail_compose_message.py'
--- email_template/wizard/mail_compose_message.py	2012-12-18 02:52:30 +0000
+++ email_template/wizard/mail_compose_message.py	2013-01-09 07:33:24 +0000
@@ -82,7 +82,12 @@
                     'res_id': res_id,
                     'type': 'binary', # override default_type from context, possibly meant for another model!
                 }
-                values['attachment_ids'].append(ir_attach_obj.create(cr, uid, data_attach, context=context))
+                attach_ids = ir_attach_obj.search(cr, uid, [('name','=', attach_fname), ('res_model','=', model), ('res_id', '=',res_id)])
+                if attach_ids:
+                    values['attachment_ids'].append(attach_ids[0])
+                else:                    
+                    new_attach_id = ir_attach_obj.create(cr, uid, data_attach, context=context)
+                    values['attachment_ids'].append(new_attach_id)
         else:
             values = self.default_get(cr, uid, ['body', 'subject', 'partner_ids', 'attachment_ids'], context=context)
 

=== modified file 'mail/wizard/mail_compose_message.py'
--- mail/wizard/mail_compose_message.py	2012-12-21 09:59:02 +0000
+++ mail/wizard/mail_compose_message.py	2013-01-09 07:33:24 +0000
@@ -204,7 +204,7 @@
                     'body': wizard.body,
                     'parent_id': wizard.parent_id and wizard.parent_id.id,
                     'partner_ids': [(4, partner.id) for partner in wizard.partner_ids],
-                    'attachments': [(attach.datas_fname or attach.name, base64.b64decode(attach.datas)) for attach in wizard.attachment_ids],
+                    'attachments': [],
                 }
                 # mass mailing: render and override default values
                 if mass_mail_mode and wizard.model:

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : openerp-dev-gtk@lists.launchpad.net
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to