From 3daa2d80c517bb0fd160cd1350a811b52200c2a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=A9o=20Goddet?= Date: Sat, 30 Oct 2021 16:38:26 +0200 Subject: [PATCH] [FIX]account_reconcile_widget: value cleaning & decimal separator choice When decimal separator is a dot, it has a special meaning in the regex (any character) that cause problem For instance in 123.40 the regex will match .4 and remove it. And then the proposal will be base on the number 120 instead of 123.40 The other problem with the actual regex is that minus sign get removed In the fix, we start by replacing the decimal_separator by a dot (before it was done after the cleaning) and the clean with a character class that is clearly specified (dot, minus, numbers) Bug was already present in odoo13 EE and CE --- .../static/src/js/reconciliation/reconciliation_model.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/account_reconciliation_widget/static/src/js/reconciliation/reconciliation_model.js b/account_reconciliation_widget/static/src/js/reconciliation/reconciliation_model.js index afb60410..7c962d1e 100644 --- a/account_reconciliation_widget/static/src/js/reconciliation/reconciliation_model.js +++ b/account_reconciliation_widget/static/src/js/reconciliation/reconciliation_model.js @@ -1603,7 +1603,10 @@ odoo.define("account.ReconciliationModel", function (require) { ); if (matching && matching.length === 2) { matching = matching[1].replace( - new RegExp("\\D" + reconcileModel.decimal_separator, "g"), + new RegExp( + "[^-\\d" + reconcileModel.decimal_separator + "]", + "g" + ), "" ); matching = matching.replace(