From c885e76152bd7357ea00c5cb30b933976a0a1971 Mon Sep 17 00:00:00 2001 From: Jorge Pinna Puissant Date: Fri, 28 Jul 2023 10:33:23 +0000 Subject: [PATCH] [REF] *: remove unused parameter from record save method Remove unused parameters from record save method : - stayInEdition - useSaveErrorDialog - savePoint - force - closable closes odoo/odoo#133152 Related: odoo/enterprise#46289 Signed-off-by: Pierre Rousseau (pro) --- .../components/account_move_form/account_move_form.js | 4 +--- .../auto_save_res_partner_bank.js | 2 +- .../autosave_many2many_tags/autosave_many2many_tags.js | 2 +- .../res_config_settings_buttons.js | 7 +------ .../verification_code_widget.js | 6 +----- .../calendar_connect_provider.js | 2 +- .../src/js/im_livechat_chatbot_steps_one2many.js | 2 +- .../src/question_page/question_page_list_renderer.js | 2 +- .../web/static/src/views/fields/translation_button.js | 2 +- addons/web/static/src/views/form/form_controller.js | 10 +--------- .../src/views/kanban/kanban_record_quick_create.js | 2 -- .../settings_form_view/settings_form_controller.js | 2 +- 12 files changed, 11 insertions(+), 32 deletions(-) diff --git a/addons/account/static/src/components/account_move_form/account_move_form.js b/addons/account/static/src/components/account_move_form/account_move_form.js index e73fdef50dd..cc60709718b 100644 --- a/addons/account/static/src/components/account_move_form/account_move_form.js +++ b/addons/account/static/src/components/account_move_form/account_move_form.js @@ -40,9 +40,7 @@ export class AccountMoveFormRenderer extends FormRenderer { if (this.props.record.isInEdition && await this.props.record.isDirty()) { const contentEl = document.querySelector('.o_content'); const scrollPos = contentEl.scrollTop; - await this.props.record.save({ - stayInEdition: true, - }); + await this.props.record.save(); if (scrollPos) { contentEl.scrollTop = scrollPos; } diff --git a/addons/account/static/src/components/auto_save_res_partner_bank/auto_save_res_partner_bank.js b/addons/account/static/src/components/auto_save_res_partner_bank/auto_save_res_partner_bank.js index 56105128e4f..c35d3b15922 100644 --- a/addons/account/static/src/components/auto_save_res_partner_bank/auto_save_res_partner_bank.js +++ b/addons/account/static/src/components/auto_save_res_partner_bank/auto_save_res_partner_bank.js @@ -6,7 +6,7 @@ import { X2ManyField, x2ManyField } from "@web/views/fields/x2many/x2many_field" export class AutoSaveResPartnerField extends X2ManyField { async onAdd({ context, editable } = {}) { - await this.props.record.model.root.save({ stayInEdition: true }); + await this.props.record.model.root.save(); await super.onAdd({ context, editable }); } } diff --git a/addons/account/static/src/components/autosave_many2many_tags/autosave_many2many_tags.js b/addons/account/static/src/components/autosave_many2many_tags/autosave_many2many_tags.js index c7149677186..8c1860d5c39 100644 --- a/addons/account/static/src/components/autosave_many2many_tags/autosave_many2many_tags.js +++ b/addons/account/static/src/components/autosave_many2many_tags/autosave_many2many_tags.js @@ -42,7 +42,7 @@ export class AutosaveMany2ManyTagsField extends Many2ManyTagsField { } async _saveOnUpdate() { - await this.props.record.model.root.save({ stayInEdition: true }); + await this.props.record.model.root.save(); } } diff --git a/addons/account_peppol/static/src/components/res_config_settings_buttons/res_config_settings_buttons.js b/addons/account_peppol/static/src/components/res_config_settings_buttons/res_config_settings_buttons.js index f956936ca3f..6d1ced1f67a 100644 --- a/addons/account_peppol/static/src/components/res_config_settings_buttons/res_config_settings_buttons.js +++ b/addons/account_peppol/static/src/components/res_config_settings_buttons/res_config_settings_buttons.js @@ -47,12 +47,7 @@ class PeppolSettingsButtons extends Component { } async _save () { - this.env.model.root.save({ - noReload: true, - stayInEdition: true, - useSaveErrorDialog: false, - savePoint: true, - }); + this.env.model.root.save({ noReload: true }); } showConfirmation(warning, methodName) { diff --git a/addons/account_peppol/static/src/components/verification_code_widget/verification_code_widget.js b/addons/account_peppol/static/src/components/verification_code_widget/verification_code_widget.js index 774f37cc7f3..e7b338191d2 100644 --- a/addons/account_peppol/static/src/components/verification_code_widget/verification_code_widget.js +++ b/addons/account_peppol/static/src/components/verification_code_widget/verification_code_widget.js @@ -62,11 +62,7 @@ class VerificationCodeWidget extends Component { _save() { let verificationCode = [...this.inputs.map((i) => i.el.value)].join(''); this.props.record.update({ account_peppol_verification_code: verificationCode }); - this.env.model.root.save({ - noReload: true, - stayInEdition: true, - useSaveErrorDialog: true, - }); + this.env.model.root.save({ noReload: true }); } } diff --git a/addons/calendar/static/src/components/calendar_provider_config/calendar_connect_provider.js b/addons/calendar/static/src/components/calendar_provider_config/calendar_connect_provider.js index 3784fbf748a..221e64781c6 100644 --- a/addons/calendar/static/src/components/calendar_provider_config/calendar_connect_provider.js +++ b/addons/calendar/static/src/components/calendar_provider_config/calendar_connect_provider.js @@ -34,7 +34,7 @@ export class CalendarConnectProvider extends Component { async onConnect(ev) { ev.preventDefault(); ev.stopImmediatePropagation(); - if (!await this.props.record.save({stayInEdition: true})) { + if (!await this.props.record.save()) { return; // handled by view } await this.orm.call( diff --git a/addons/im_livechat/static/src/js/im_livechat_chatbot_steps_one2many.js b/addons/im_livechat/static/src/js/im_livechat_chatbot_steps_one2many.js index aa4bc00a575..a391a60a805 100644 --- a/addons/im_livechat/static/src/js/im_livechat_chatbot_steps_one2many.js +++ b/addons/im_livechat/static/src/js/im_livechat_chatbot_steps_one2many.js @@ -78,7 +78,7 @@ export class ChatbotStepsOne2many extends X2ManyField { getList: () => this.list, saveRecord: async (record) => { await saveRecord(record); - await this.props.record.save({ stayInEdition: true }); + await this.props.record.save(); }, updateRecord: updateRecord, }); diff --git a/addons/survey/static/src/question_page/question_page_list_renderer.js b/addons/survey/static/src/question_page/question_page_list_renderer.js index 25e19fe5b0c..9923fd5b38d 100644 --- a/addons/survey/static/src/question_page/question_page_list_renderer.js +++ b/addons/survey/static/src/question_page/question_page_list_renderer.js @@ -138,7 +138,7 @@ export class QuestionPageListRenderer extends ListRenderer { ); if (triggeredRecords.length) { const res = await super.onDeleteRecord(record); - await this.props.list.model.root.save({ stayInEdition: true }); + await this.props.list.model.root.save(); return res; } else { return super.onDeleteRecord(record); diff --git a/addons/web/static/src/views/fields/translation_button.js b/addons/web/static/src/views/fields/translation_button.js index 5960fcc1bf7..73c0b68f7d7 100644 --- a/addons/web/static/src/views/fields/translation_button.js +++ b/addons/web/static/src/views/fields/translation_button.js @@ -18,7 +18,7 @@ export function useTranslationDialog() { const addDialog = useOwnedDialogs(); async function openTranslationDialog({ record, fieldName }) { - const saved = await record.save({ force: true }); + const saved = await record.save(); if (!saved) { return; } diff --git a/addons/web/static/src/views/form/form_controller.js b/addons/web/static/src/views/form/form_controller.js index 4c9c979b31b..b6e4c24ef04 100644 --- a/addons/web/static/src/views/form/form_controller.js +++ b/addons/web/static/src/views/form/form_controller.js @@ -322,7 +322,6 @@ export class FormController extends Component { if (dirty) { canProceed = await this.model.root.save({ noReload: true, - stayInEdition: true, onError: this.onSaveError.bind(this), }); } @@ -335,7 +334,6 @@ export class FormController extends Component { if (this.model.root.dirty) { return this.model.root.save({ noReload: true, - stayInEdition: true, onError: this.onSaveError.bind(this), }); } @@ -430,7 +428,6 @@ export class FormController extends Component { if ((dirty || this.model.root.isNew) && !item.skipSave) { let hasError = false; const isSaved = await this.model.root.save({ - stayInEdition: true, onError: (...args) => { hasError = true; return this.onSaveError(...args); @@ -480,11 +477,7 @@ export class FormController extends Component { async beforeExecuteActionButton(clickParams) { if (clickParams.special !== "cancel") { const noReload = this.env.inDialog && clickParams.close; - const params = { - force: true, - stayInEdition: true, - noReload, - }; + const params = { noReload }; if (!this.env.inDialog) { params.onError = this.onSaveError.bind(this); } @@ -503,7 +496,6 @@ export class FormController extends Component { async create() { const canProceed = await this.model.root.save({ - stayInEdition: true, onError: this.onSaveError.bind(this), }); // FIXME: disable/enable not done in onPagerUpdate diff --git a/addons/web/static/src/views/kanban/kanban_record_quick_create.js b/addons/web/static/src/views/kanban/kanban_record_quick_create.js index af2fa73a4b5..9a6c0a1ed5c 100644 --- a/addons/web/static/src/views/kanban/kanban_record_quick_create.js +++ b/addons/web/static/src/views/kanban/kanban_record_quick_create.js @@ -157,9 +157,7 @@ class KanbanQuickCreateController extends Component { } } else { await this.model.root.save({ - closable: true, noReload: true, - force: true, onError: (e) => this.showFormDialogInError(e), }); resId = this.model.root.resId; diff --git a/addons/web/static/src/webclient/settings_form_view/settings_form_controller.js b/addons/web/static/src/webclient/settings_form_view/settings_form_controller.js index caf691b3754..3b884ac479d 100644 --- a/addons/web/static/src/webclient/settings_form_view/settings_form_controller.js +++ b/addons/web/static/src/webclient/settings_form_view/settings_form_controller.js @@ -66,7 +66,7 @@ export class SettingsFormController extends formView.Controller { ) { return this._confirmSave(); } else { - return this.model.root.save({ stayInEdition: true }); + return this.model.root.save(); } }