← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~therp-nl/ocb-addons/6.1-lp1342360-fetchmail_file_storage_duplicate_attachment_ids into lp:ocb-addons/6.1

 

Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/ocb-addons/6.1-lp1342360-fetchmail_file_storage_duplicate_attachment_ids into lp:ocb-addons/6.1.

Requested reviews:
  OpenERP Community Backports (ocb)
Related bugs:
  Bug #1342360 in OpenERP Community Backports (Addons): "[6.1] Fetchmail + file storage + duplicate attachment = uniqueness constraint violation"
  https://bugs.launchpad.net/ocb-addons/+bug/1342360

For more details, see:
https://code.launchpad.net/~therp-nl/ocb-addons/6.1-lp1342360-fetchmail_file_storage_duplicate_attachment_ids/+merge/226933

See bug description. The duplication is no longer performed in OpenERP 7.0, so it only affects 6.1
-- 
https://code.launchpad.net/~therp-nl/ocb-addons/6.1-lp1342360-fetchmail_file_storage_duplicate_attachment_ids/+merge/226933
Your team OpenERP Community Backports is requested to review the proposed merge of lp:~therp-nl/ocb-addons/6.1-lp1342360-fetchmail_file_storage_duplicate_attachment_ids into lp:ocb-addons/6.1.
=== modified file 'mail/mail_thread.py'
--- mail/mail_thread.py	2013-09-10 15:12:35 +0000
+++ mail/mail_thread.py	2014-07-15 21:26:07 +0000
@@ -221,7 +221,12 @@
                     'res_model': thread._name,
                     'res_id': thread.id,
                 }
-                to_attach.append(ir_attachment.create(cr, uid, data_attach, context=context))
+
+                attachment_id = ir_attachment.create(cr, uid, data_attach, context=context)
+                # Document module can return the same ID multiple times if the
+                # same document is attached twice due to deduplication
+                if attachment_id not in to_attach:
+                    to_attach.append(attachment_id)
 
             partner_id = hasattr(thread, 'partner_id') and (thread.partner_id and thread.partner_id.id or False) or False
             if not partner_id and thread._name == 'res.partner':


Follow ups