[FIX] mail: no insert message when delete attachment from composer

Before this commit, when deleting an attachment from composer,
an undefined message was inserted in the store.

closes odoo/odoo#125313

X-original-commit: ec814f14222509caa27d627a193e6eaebe9bbf60
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Maryam Kia
2023-06-16 01:40:35 +02:00
committed by Alexandre Kühn
parent 9b55c4565b
commit 651476db87
+1 -1
View File
@@ -42,7 +42,7 @@ class IrAttachment(models.Model):
if message:
message.write({}) # to make sure write_date on the message is updated
self.env['bus.bus']._sendmany((attachment._bus_notification_target(), 'ir.attachment/delete', {
'id': attachment.id, 'message': {'id': message.id, 'write_date': message.write_date} if message else {}
'id': attachment.id, 'message': {'id': message.id, 'write_date': message.write_date} if message else None
}) for attachment in self)
self.unlink()