-
- Downloads
[FIX] mail: clean context on attachments creation
Manual backport of odoo/odoo@4504c9d8069082c9542226fbafdbf309089cf7a9 done in 13
Steps to reproduce :
- Install `CRM` and `Sales` modules
- Go to Settings, activate "External Email Servers" and
set an alias.
- Edit 'Sales Team Europe' : add an alias
(ensure alias end with the "External Email Servers" alias)
- Send a mail to the europe sale team alias email with a
base64 image in the html body
ex: <img alt="" src="data:image/png;base64,ABCDE123....789">
Issue :
- Traceback is raised.
("ValueError: Wrong value for ir.attachment.type: 'opportunity'.")
Cause :
Both `crm.lead` and `ir.attachment` have a `type` field.
When creating the thread, in this case of crm.lead model,
it will add the 'default_type' and 'default_team_id' to the
context.
The context will be inhrited and used on the creation of the
ir.attachment (in this case its the base64 encoded image
inside the body).
Since no `type` was provided while creating the ir.attachment,
it will set the type from `default_type` in context since
available.
Solution :
- Clean the context (in this case, it will remove `default_X` values)
when creating the ir.attachment .
opw-2551461
closes odoo/odoo#74374
Signed-off-by:
Thibault Delavallee (tde) <tde@openerp.com>
Please register or sign in to comment