Aurélien Warnon b46153f6cf [FIX] mail: fix mail.mail default values collision
This commit cleans the default_* keys of the context before creating mail.mails
and mail.notifications when notifying the record by email.

Without this change, there can be a collision when the ORM tries to compute
default values for the state field (for example):
- Model "A" has a 'state' field ;
- Create an action that redirects to model "A" form view, setting some default
  values in the context such as {'default_state': 'done'} ;
- Model "A" has an inherit on 'mail.thread' and a 'user_id' field to set a
  responsible user ;
- Model "A" record is created with a responsible user, who is automatically
  notified by email that the record "has been assigned to him" ;
  (see mail_thread#_message_auto_subscribe_notify)
- A 'mail.mail' is in turn created ;
- The 'mail.mail' model ALSO has a 'state' field, and the context is propagated
  so the ORM will try to assign 'done' to that field, which is an incorrect
  value ;
- -> Crash.

If we ensure that the default_* keys are cleaned from the context, the default
values computation of the mail.mail record will not be affected and everything
works fine.

A test was added to ensure this behavior.

Task 2393259

closes odoo/odoo#62589

X-original-commit: 6b6e546ac95d9acb2964121dd52aa2896d31bc33
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
2020-11-30 10:25:36 +00:00
2020-11-30 07:07:58 +00:00
2020-04-20 11:41:39 +00:00
…
…
…
2019-11-08 11:24:04 +00:00
2020-09-28 14:07:25 +00:00

Build Status Tech Doc Help Nightly Builds

Odoo

Odoo is a suite of web based open source business apps.

The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...

Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

Getting started with Odoo

For a standard installation please follow the Setup instructions from the documentation.

To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials

S
Description
No description provided
Readme LGPL-3.0
3.4 GiB
Languages
Python 49.6%
JavaScript 47.8%
SCSS 2%
CSS 0.3%
HTML 0.2%