[6.1] Fetchmail + file storage + duplicate attachment = uniqueness constraint violation

Bug #1342360 reported by Stefan Rijnhart (Opener)
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
OpenERP Community Backports (Addons)
New
Undecided
Unassigned
6.1
Fix Committed
Undecided
Stefan Rijnhart (Opener)

Bug Description

On a system with document storage enabled, fetchmail will try to create a mail with attachment_ids set to [(6, 0, [1234, 1234])] if an email contains the same document twice. This leads to the following error:

  File "/home/openerp/openobject-addons/mail/mail_thread.py", line 134, in message_new
    self.message_append_dict(cr, uid, [res_id], msg_dict, context=context)
  File "/home/openerp/openobject-addons/mail/mail_thread.py", line 305, in message_append_dict
    context = context)
  File "/home/openerp/openobject-addons/mail/mail_thread.py", line 269, in message_append
    mail_message.create(cr, uid, data, context=context)
  File "/home/openerp/openobject-addons/fetchmail/fetchmail.py", line 250, in create
    res = super(mail_message,self).create(cr, uid, values, context=context)
  File "/home/therp/bzr/openobject-server/openerp/osv/orm.py", line 4235, in create
    result += self._columns[field].set(cr, self, id_new, field, vals[field], user, rel_context) or []
  File "/home/therp/bzr/openobject-server/openerp/osv/fields.py", line 784, in set
    cr.execute('insert into '+rel+' ('+id1+','+id2+') values (%s, %s)', (id, act_nbr))
  File "/home/therp/bzr/openobject-server/openerp/sql_db.py", line 152, in wrapper
    return f(self, *args, **kwargs)
  File "/home/therp/bzr/openobject-server/openerp/sql_db.py", line 212, in execute
    res = self._obj.execute(query, params)
IntegrityError: duplicate key value violates unique constraint "message_attachment_rel_message_id_key"

Related branches

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.