diff options
| author | Aurélien Warnon <awa@odoo.com> | 2020-11-25 12:53:53 +0000 |
|---|---|---|
| committer | Aurélien Warnon <awa@odoo.com> | 2020-11-30 07:55:52 +0000 |
| commit | 6b6e546ac95d9acb2964121dd52aa2896d31bc33 (patch) | |
| tree | fcfcf4500aac1a991fcc5b873e5be37f742f9fcf /addons/project/views | |
| parent | db3296c034fe4c82d19580418fd5cdecdf578395 (diff) | |
[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#62545
X-original-commit: 769bef6560cc3aa565a3530549bdad19fc6cac4c
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
Diffstat (limited to 'addons/project/views')
0 files changed, 0 insertions, 0 deletions
