From 9f1241b84cf0584f33177871b2ccd1ae774f4072 Mon Sep 17 00:00:00 2001 From: Ahmad Khanalizadeh Date: Tue, 26 Jul 2022 11:19:49 +0000 Subject: [PATCH] [FIX] point_of_sale: use taxed prices in discount comparison Before this commit, If "Show public price & discount to the customer" discount display policy is selected, taxed prices in the pricelist with discounts are compared with untaxed prices in the public pricelist, which leads to not showing the discounted values when the pricelist value is less than untaxed list price, but the taxed value is more than untaxed list price. Steps to reproduce: 1. Create a product, add it to a pricelist with a lower price in a way that if the tax is added the price is more than its sale price, add a tax option to the product 2. Set the pricelist discount display policy as `Show public price & discount to the customer` 3. Set the PoS to use tax-included prices, and to use the discounted pricelist 4. start the PoS session, add the product, you will see that the public price isn't shown (with a strike-through) To fix, we can use a different function that computes the taxed public price, so it could be compared with the pricelist price. opw-2919734 closes odoo/odoo#97698 X-original-commit: bbada7911ab59ca20c97fd152112116cab0bf398 Signed-off-by: Joseph Caburnay (jcb) --- addons/point_of_sale/static/src/js/models.js | 10 ++++++++++ .../static/src/xml/Screens/ProductScreen/Orderline.xml | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index 488ad056cf3..458fbca1da6 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -1848,6 +1848,16 @@ class Orderline extends PosModel { return this.get_base_price(); } } + get_taxed_lst_unit_price(){ + var lst_price = this.get_lst_price(); + if (this.pos.config.iface_tax_included === 'total') { + var product = this.get_product(); + var taxes_ids = product.taxes_id; + var product_taxes = this.get_taxes_after_fp(taxes_ids); + return this.compute_all(product_taxes, lst_price, 1, this.pos.currency.rounding).total_included; + } + return lst_price; + } get_price_without_tax(){ return this.get_all_prices().priceWithoutTax; } diff --git a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml index 9cfead35289..ca9f441a4cc 100644 --- a/addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml +++ b/addons/point_of_sale/static/src/xml/Screens/ProductScreen/Orderline.xml @@ -37,9 +37,9 @@ at + env.pos.round_decimals_currency(props.line.get_unit_display_price()) < env.pos.round_decimals_currency(props.line.get_taxed_lst_unit_price())"> - +