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.
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