Use a promise based API for Record.pre_validate()

Closes #12039
(grafted from 2e62e2dc88702ffdcb98ac3185b92e08ae2af937)

--HG--
branch : 6.0
This commit is contained in:
Nicolas Évrard committed 2023-01-25 15:14:26 +01:00
1 parent eda506c165
commit 3b7a0953aa
2 files changed
+5 -7

No files matched your search

+1 -6
View File
@@ -1302,12 +1302,7 @@
var values = this._get_on_change_args(
Object.keys(this._changed).concat(['id']));
return this.model.execute('pre_validate',
[values], this.get_context())
.then(function() {
return true;
}, function() {
return false;
});
[values], this.get_context());
},
cancel: function() {
this._loaded = {};
+4 -1
View File
@@ -430,7 +430,10 @@
this.screen.current_record) {
this.screen.current_record.validate().then(function(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;
}.bind(this)).then(function(validate) {