Skip to content
Permalink
Browse files

[FIX] mail: upload_attachment without model

The method /web/binary/upload_attachment may be used (eg. it is the case
in enterprise documents module) without res_model (eg. if folder_id is
specified).

Thus we should make it work (that was not possible since a26496b).

opw-1964091
opw-1965832
opw-1967181
opw-1968063
closes #32692

Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
  • Loading branch information...
nle-odoo committed Apr 15, 2019
1 parent a68412c commit 77a2411171e439833f14245767743fdd3e3c7212
Showing with 2 additions and 0 deletions.
  1. +2 −0 addons/mail/models/ir_attachment.py
@@ -20,6 +20,8 @@ def register_as_main_attachment(self, force=True):
attached to.
"""
self.ensure_one()
if not self.res_model:
return
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

0 comments on commit 77a2411

Please sign in to comment.
You can’t perform that action at this time.