From 3283582bd60c72ec170e913b4a818fd2bbe838f3 Mon Sep 17 00:00:00 2001 From: Sylvain LE GAL Date: Mon, 21 Jun 2021 11:23:22 +0200 Subject: [PATCH] [FIX] pos_margin : do not raise JS error if iface_display_margin is disabled, when loading point of sale --- pos_margin/static/src/js/screens.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pos_margin/static/src/js/screens.js b/pos_margin/static/src/js/screens.js index 55cbb2c37e..c137783b02 100644 --- a/pos_margin/static/src/js/screens.js +++ b/pos_margin/static/src/js/screens.js @@ -14,8 +14,10 @@ odoo.define("pos_margin.screens", function (require) { if (!order.get_orderlines().length) { return; } - this.el.querySelector(".summary .order-margin .value-margin-rate").textContent = this.format_pr(order.get_margin_rate(), 0.01) + "%"; - this.el.querySelector(".summary .order-margin .value-margin").textContent = this.format_currency(order.get_margin()); + if (this.pos.config.iface_display_margin) { + this.el.querySelector(".summary .order-margin .value-margin-rate").textContent = this.format_pr(order.get_margin_rate(), 0.01) + "%"; + this.el.querySelector(".summary .order-margin .value-margin").textContent = this.format_currency(order.get_margin()); + } }, });