From e9430ac5c1ed41b19b208e02ac8f3d9782f1ad0e Mon Sep 17 00:00:00 2001 From: wan Date: Wed, 22 May 2019 09:22:43 +0000 Subject: [PATCH] [FIX] account: crazy To Check checkbox in reconciliation widget Reproduce: Add multiple lines in the reconciliation widget Try to create a new one and edit it Problem: A constraint checks that all the lines have the same value for To Check, but the value is not provided if another field changed. Since true !== undefined !== false, a warning was raised. Solution: Only fire check the constraint if to_check is in the values. closes odoo/odoo#33560 Signed-off-by: Cedric Snauwaert (csn) --- .../static/src/js/reconciliation/reconciliation_model.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index 1d5eee2a700..b8ba7b7712d 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -624,12 +624,12 @@ var StatementModel = BasicModel.extend({ prop = this._formatQuickCreate(line); line.reconciliation_proposition.push(prop); } - if (!line.reconciliation_proposition.slice(0,-1).every(function(prop) {return prop.to_check == values.to_check})) { + if ('to_check' in values && !line.reconciliation_proposition.slice(0,-1).every(function(prop) {return prop.to_check == values.to_check})) { new CrashManager().show_warning({data: { exception_type: _t("Incorrect Operation"), message: _t("You cannot mix items with and without the 'To Check' checkbox ticked.") }}); - $('.create_to_check input').click(); + $('.create_to_check input:visible').prop('checked', !values.to_check).change(); return $.when(); } _.each(values, function (value, fieldName) {