From 40290102ffd23fe0473565e01e637feb5395d2cb Mon Sep 17 00:00:00 2001 From: mega-odoo <mega@odoo.com> Date: Wed, 7 Jun 2023 11:27:46 +0000 Subject: [PATCH] [FIX] web_editor: prevent error when edit the float, monetary section in website 'replace() argument 1 must be str, not bool' is generated if the user edit a float or monetary section in the website view. Steps to Reproduce - Make debugger mode ON. - Go to Settings > Translations > Languages. - Remove the value of the 'Thousands Separator' field from the current user language. - Install the 'eCommerce' module. - Go to the website. - Go to the shop menu, and click any product from the product list. - Click on the Edit button and try to edit any float or monetary section like a product price (eg. change a product price from 750 to 70) and click on the Save button. And traceback will be generated. Applying this commit will resolve this issue. sentry-4148693017 closes odoo/odoo#125634 X-original-commit: b895175cfc487f3db6e53351fd5774303f193698 Signed-off-by: David Monjoie (dmo) <dmo@odoo.com> --- addons/web_editor/models/ir_qweb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/web_editor/models/ir_qweb.py b/addons/web_editor/models/ir_qweb.py index e0ea516bce15..08afce2ccf2d 100644 --- a/addons/web_editor/models/ir_qweb.py +++ b/addons/web_editor/models/ir_qweb.py @@ -175,7 +175,7 @@ class Integer(models.AbstractModel): def from_html(self, model, field, element): lang = self.user_lang() value = element.text_content().strip() - return int(value.replace(lang.thousands_sep, '')) + return int(value.replace(lang.thousands_sep or '', '')) class Float(models.AbstractModel): @@ -187,7 +187,7 @@ class Float(models.AbstractModel): def from_html(self, model, field, element): lang = self.user_lang() value = element.text_content().strip() - return float(value.replace(lang.thousands_sep, '') + return float(value.replace(lang.thousands_sep or '', '') .replace(lang.decimal_point, '.')) @@ -494,7 +494,7 @@ class Monetary(models.AbstractModel): value = element.find('span').text.strip() - return float(value.replace(lang.thousands_sep, '') + return float(value.replace(lang.thousands_sep or '', '') .replace(lang.decimal_point, '.')) -- GitLab