diff options
| author | Nans Lefebvre <len@odoo.com> | 2019-03-18 15:26:04 +0000 |
|---|---|---|
| committer | Nans Lefebvre <len@odoo.com> | 2019-03-18 15:27:20 +0000 |
| commit | eee6e26b37c4cb70543070efa87cd33b6497b7db (patch) | |
| tree | f8668325de80041cf9a5473cfc243a634784a3d9 | |
| parent | 273fc4af6eb515db6ee63855679f2b65bd0583ac (diff) | |
[FIX] mail_enterprise: display all attachements in preview widget
If res_id is not defined, this method used to crash.
Made obvious by commit a26496b6e79153212973c55f20431df82c3d827b,
which added a call to that function in the main controller of web.
opw 1950403
closes odoo/odoo#31923
Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
| -rw-r--r-- | addons/mail/models/ir_attachment.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/mail/models/ir_attachment.py b/addons/mail/models/ir_attachment.py index acc14b2b6f9..4330059c495 100644 --- a/addons/mail/models/ir_attachment.py +++ b/addons/mail/models/ir_attachment.py @@ -23,5 +23,5 @@ class IrAttachment(models.Model): related_record = self.env[self.res_model].browse(self.res_id) # message_main_attachment_id field can be empty, that's why we compare to False; # we are just checking that it exists on the model before writing it - if hasattr(related_record, 'message_main_attachment_id'): + if related_record and hasattr(related_record, 'message_main_attachment_id'): related_record.message_main_attachment_id = self |
