-
- Downloads
[FIX] *: override save checks that the save is valid
The goal of this commit is to avoid the execution of code depending
on the validity of the save of a Record.
Before this commit, several override save functions in Record execute
code after the record's save without checking if the record's save has
taken place.
Override before:
export class NewRecord extends Record {
async save() {
const isSaved = await super.save(...arguments);
// doAction
return isSaved;
}
}
Override after:
export class NewRecord extends Record {
async save() {
const isSaved = await super.save(...arguments);
if (isSaved) {
// doAction
}
return isSaved;
}
}
How to reproduce the problem:
Go to a form view with a Record having its save override function.
Edit a record in such a way to have an invalid field
Click on the save button
Before this commit:
The doAction is executed
After this commit:
The doAction is not executed
Real use case
- Go to the form view of a lead in CRM
- Change stage
- Clear the name field
- Click on save button
Before this commit:
A call to get_rainbowman_message is made
After this commit:
No call to get_rainbowman_message is made.
closes odoo/odoo#105468
Related: odoo/enterprise#33817
Signed-off-by:
Aaron Bohy (aab) <aab@odoo.com>
Showing
- addons/crm/static/src/views/crm_form/crm_form.js 3 additions, 3 deletionsaddons/crm/static/src/views/crm_form/crm_form.js
- addons/event_booth_sale/static/src/js/event_booth_configurator_model.js 7 additions, 4 deletions...ooth_sale/static/src/js/event_booth_configurator_model.js
- addons/event_sale/static/src/js/event_configurator_model.js 7 additions, 4 deletionsaddons/event_sale/static/src/js/event_configurator_model.js
- addons/hr/static/src/views/profile_form_view.js 3 additions, 3 deletionsaddons/hr/static/src/views/profile_form_view.js
Please register or sign in to comment