[FIX] mail: create attachments on the correct record when using the popup editor

Send a message using the popup editor.
Drag and drop an image into the message content.
It will create an attachment for the inlined image.
However it did give a res_model value of mail.message but no res_id;
add_missing_default_value would fill in the res_id from the _context, which is
not the mail_message but the current object on which it applies
(e.g. helpdesk.ticket).
We put the correct res_model along with the res_id.

opw 1903194

closes odoo/odoo#28526
This commit is contained in:
len-odoo
2018-11-09 13:28:07 +00:00
parent ac5a1662f2
commit 5c2f96d0dd
+2 -1
View File
@@ -767,7 +767,8 @@ class Message(models.Model):
'name': name,
'datas': match.group(2),
'datas_fname': name,
'res_model': 'mail.message',
'res_model': values.get('model'),
'res_id': values.get('res_id'),
})
attachment.generate_access_token()
values['attachment_ids'].append((4, attachment.id))