[IMP] mail_message: attachments deleted when unlinking are those with model=self._name, not only 'mail.mesage'. This allows to remove the unlink override in mail.compose.message.
bzr revid: tde@openerp.com-20120906125217-27nlyveznh12bk63
This commit is contained in:
parent
e34fcc076c
commit
a1fe453223
|
@ -310,11 +310,11 @@ class mail_message(osv.Model):
|
|||
attachments_to_delete = []
|
||||
for mail in self.browse(cr, uid, ids, context=context):
|
||||
for attach in mail.attachment_ids:
|
||||
if attach.res_model == 'mail.message' and attach.res_id == mail.id:
|
||||
if attach.res_model == self._name and attach.res_id == mail.id:
|
||||
attachments_to_delete.append(attach.id)
|
||||
if attachments_to_delete:
|
||||
self.pool.get('ir.attachment').unlink(cr, uid, attachments_to_delete, context=context)
|
||||
return super(mail_message,self).unlink(cr, uid, ids, context=context)
|
||||
return super(mail_message, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
def notify(self, cr, uid, newid, context=None):
|
||||
""" Add the related record followers to the destination partner_ids.
|
||||
|
|
|
@ -221,12 +221,6 @@ class mail_compose_message(osv.TransientModel):
|
|||
res.update(self._verify_partner_email(cr, uid, value[0][2], context=context))
|
||||
return res
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
# Cascade delete all attachments, as they are owned by the composition wizard
|
||||
for wizard in self.read(cr, uid, ids, ['attachment_ids'], context=context):
|
||||
self.pool.get('ir.attachment').unlink(cr, uid, wizard['attachment_ids'], context=context)
|
||||
return super(mail_compose_message, self).unlink(cr, uid, ids, context=context)
|
||||
|
||||
def dummy(self, cr, uid, ids, context=None):
|
||||
""" TDE: defined to have buttons that do basically nothing. It is
|
||||
currently impossible to have buttons that do nothing special
|
||||
|
|
Loading…
Reference in New Issue