Use a promise based API for Record.pre_validate()

Closes #12039
This commit is contained in:
Nicolas Évrard committed 2023-01-25 15:14:26 +01:00
1 parent 575527bf60
commit 45043d706e
2 files changed
+5 -3

No files matched your search

+1 -2
View File
@@ -1262,8 +1262,7 @@
var values = this._get_on_change_args(
Object.keys(this.modified_fields).concat(['id']));
return this.model.execute('pre_validate',
[values], this.get_context())
.then(() => true, () => false);
[values], this.get_context());
},
cancel: function() {
this._loaded = {};
+4 -1
View File
@@ -479,7 +479,10 @@
this.screen.current_record) {
this.screen.current_record.validate().then(validate => {
if (validate && this.screen.attributes.pre_validate) {
return this.screen.current_record.pre_validate();
return this.screen.current_record.pre_validate().then(
function () { return true; },
function () { return false; }
);
}
return validate;
}).then(validate => {