From e9bf6c6364cae1727aa82ea05d2703aa291a3889 Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Tue, 19 Apr 2022 11:39:47 +0000 Subject: [PATCH] [FIX] point_of_sale: prevent showing downpayment as discount on receipt Current behavior: When applying a discount and a downpayment on a product in the PoS the discount line on the receipt would be the sum of the discount and the downpayment. But the downpayment is not a discount. Steps to reproduce: - Install PoS - Change discount policy to Show public price & discount to the customer, in the public pricelist - Create a promotion program that applies 10% discount - Use this promotion program in the PoS - Create a quotation for any product (e.g with a product that cost 1000$) - In the PoS go in the quotation/order and apply a downpayment to this quotation. - Pay the downpayment, and go in the quotation/order again. But this time settle the order. - After the payment on the receipt you will see the discount line value is not correct. It's the sum of the discount + the downpayment opw-2792417 closes odoo/odoo#89213 X-original-commit: fc546e0481ae0159e67791240833bc1e38a4440f Signed-off-by: Masereel Pierre Signed-off-by: Engels Robin (roen) --- addons/point_of_sale/static/src/js/models.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/point_of_sale/static/src/js/models.js b/addons/point_of_sale/static/src/js/models.js index f4c85fc33c7..7de80296b6b 100644 --- a/addons/point_of_sale/static/src/js/models.js +++ b/addons/point_of_sale/static/src/js/models.js @@ -2724,6 +2724,9 @@ class Order extends PosModel { } get_total_discount() { return round_pr(this.orderlines.reduce((function(sum, orderLine) { + if (orderLine.pos.config.down_payment_product_id[0] === orderLine.product.id) { + return 0; + } sum += (orderLine.get_unit_price() * (orderLine.get_discount()/100) * orderLine.get_quantity()); if (orderLine.display_discount_policy() === 'without_discount'){ sum += ((orderLine.get_lst_price() - orderLine.get_unit_price()) * orderLine.get_quantity());