From e8916a817c87ba7ba27b94afb5eca616ad7b97ef Mon Sep 17 00:00:00 2001 From: Romain Derie Date: Mon, 1 Apr 2019 14:06:21 +0000 Subject: [PATCH] [IMP] website_sale_delivery: use monetary 'to_html' method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before this commit: Instead of using the `to_html` method from `ir.qweb.field.monetary`, we would use `_format_amount` that would mimick `to_html` but without the HTML part, keeping only the integer amount. That was making the python, JS and XML code unnecessarily complexe. Python: code duplicated between `to_html` and `_format_amount` XML: double badge in DOM, one to show text and one to show t-field/monetary DOM structure ($ 50.5) JS: handle both badges depending if need to show text or price, complexe selector to target t-field integer DOM, and also handle d-none to show only one at a time. Now: We removed the `_format_amount` method and use the standard one. That way, XML, JS and python could be clean from unnecessary complexity. Coming from #31857 (task-1867265) closes odoo/odoo#32327 Signed-off-by: Jérémy Kersten (jke) --- addons/website_sale/views/templates.xml | 6 +-- .../views/website_sale_templates.xml | 6 ++- .../controllers/main.py | 15 +++--- .../src/js/website_sale_coupon_delivery.js | 2 +- .../website_sale_delivery/controllers/main.py | 29 ++++++------ .../static/src/js/website_sale_delivery.js | 47 +++++++++---------- .../src/scss/website_sale_delivery.scss | 2 +- .../views/website_sale_delivery_templates.xml | 5 +- 8 files changed, 55 insertions(+), 57 deletions(-) diff --git a/addons/website_sale/views/templates.xml b/addons/website_sale/views/templates.xml index aca62285f1b..c122525c56e 100644 --- a/addons/website_sale/views/templates.xml +++ b/addons/website_sale/views/templates.xml @@ -1521,19 +1521,19 @@ Subtotal: - + Taxes: - + Total: - diff --git a/addons/website_sale_coupon/views/website_sale_templates.xml b/addons/website_sale_coupon/views/website_sale_templates.xml index e4f260beb35..fa38f91e726 100644 --- a/addons/website_sale_coupon/views/website_sale_templates.xml +++ b/addons/website_sale_coupon/views/website_sale_templates.xml @@ -68,10 +68,12 @@