[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) <pro@odoo.com>
This commit is contained in:
Jorge Pinna Puissant
2023-08-25 13:59:00 +02:00
parent 6629bb802c
commit c885e76152
12 changed files with 11 additions and 32 deletions
@@ -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;
}
@@ -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 });
}
}
@@ -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();
}
}
@@ -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) {
@@ -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 });
}
}
@@ -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(
@@ -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,
});
@@ -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);
@@ -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;
}
@@ -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
@@ -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;
@@ -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();
}
}