Skip to content
Snippets Groups Projects
Commit 77a24111 authored by Nicolas Lempereur's avatar Nicolas Lempereur
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 a26496b6).

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

Signed-off-by: default avatarNicolas Lempereur (nle) <nle@odoo.com>
parent a68412c1
Branches
Tags
No related merge requests found
......@@ -20,6 +20,8 @@ class IrAttachment(models.Model):
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% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment