Skip to content
Snippets Groups Projects
Commit a3f5d0b2 authored by Qiuyu (QHO)'s avatar Qiuyu (QHO)
Browse files

[FIX] mail: functions for FieldCommand should return boolean value


The executing function for FieldCommand should return boolean value
to indicate whether the value changed for triggering the re-computation.

closes odoo/odoo#66648

Signed-off-by: default avatarSébastien Theys (seb) <seb@odoo.com>
parent 79d834f2
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,9 @@ odoo.define('mail/static/src/model/model_field_command.js', function (require) {
class FieldCommand {
/**
* @constructor
* @param {function} func function to call when executing this command
* @param {function} func function to call when executing this command.
* The function should ALWAYS return a boolean value
* to indicate whether the value changed.
*/
constructor(func) {
this.func = func;
......@@ -43,7 +45,7 @@ function clear() {
function decrement(amount = 1) {
return new FieldCommand((field, record, options) => {
const oldValue = field.get(record);
field.set(record, oldValue - amount, options);
return field.set(record, oldValue - amount, options);
});
}
......@@ -55,7 +57,7 @@ function decrement(amount = 1) {
function increment(amount = 1) {
return new FieldCommand((field, record, options) => {
const oldValue = field.get(record);
field.set(record, oldValue + amount, options);
return field.set(record, oldValue + amount, options);
});
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment