Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tryton
Tryton
Commits
505f2ae57bb9
Commit
505f2ae5
authored
Jan 25, 2023
by
Nicolas Évrard
Browse files
Use a promise based API for Record.pre_validate()
Closes
#12039
parent
9d21aacdc5f8
Pipeline
#61767
passed with stages
in 10 minutes and 55 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
sao/CHANGELOG
View file @
505f2ae5
* Use a promise based API for Record.pre_validate()
* Do not select first record by default
* Use ``&`` and ``|`` as boolean operator in search widget
* Use toggle button and label on translate dialog
...
...
sao/src/model.js
View file @
505f2ae5
...
...
@@ -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
=
{};
...
...
sao/src/window.js
View file @
505f2ae5
...
...
@@ -478,4 +478,5 @@
!
readonly
&&
this
.
screen
.
current_record
)
{
this
.
screen
.
current_record
.
validate
().
then
(
validate
=>
{
var
prm
=
jQuery
.
Deferred
();
if
(
validate
&&
this
.
screen
.
attributes
.
pre_validate
)
{
...
...
@@ -481,3 +482,8 @@
if
(
validate
&&
this
.
screen
.
attributes
.
pre_validate
)
{
return
this
.
screen
.
current_record
.
pre_validate
();
this
.
screen
.
current_record
.
pre_validate
().
then
(
()
=>
{
prm
.
resolve
(
true
);
},
()
=>
{
prm
.
resolve
(
false
);
}
);
}
else
{
prm
.
resolve
(
validate
);
}
...
...
@@ -483,5 +489,5 @@
}
return
validate
;
return
prm
;
}).
then
(
validate
=>
{
var
closing_prm
=
jQuery
.
Deferred
();
if
(
validate
&&
this
.
save_current
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment