From b13e9f5fddb393a99b9af0fba6f10dcaa257203f Mon Sep 17 00:00:00 2001 From: roen-odoo Date: Wed, 3 May 2023 14:30:39 +0000 Subject: [PATCH] [FIX] pos_discount: stop applying discount to tips Current behavior: When adding a tips to an order, then applying a global discount. The discount is applied to the tips when it should not. Steps to reproduce: - Open POS - Add a product to the order - Add a tips to the order - Apply a global discount - The discount is calculated on the tips and the products opw-3271886 closes odoo/odoo#121071 X-original-commit: 97c7ebcd203de64da43a74e298d6bfab08694c5c Signed-off-by: Joseph Caburnay (jcb) Signed-off-by: Engels Robin (roen) --- addons/pos_discount/static/src/js/DiscountButton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/pos_discount/static/src/js/DiscountButton.js b/addons/pos_discount/static/src/js/DiscountButton.js index 4b3ce7e3be9..531aef87e42 100644 --- a/addons/pos_discount/static/src/js/DiscountButton.js +++ b/addons/pos_discount/static/src/js/DiscountButton.js @@ -56,7 +56,7 @@ export class DiscountButton extends Component { .filter((id) => id !== "") .map((id) => Number(id)); - const baseToDiscount = order.calculate_base_amount(tax_ids_array, lines); + const baseToDiscount = order.calculate_base_amount(tax_ids_array, lines.filter((line) => !this.env.pos.config.tip_product_id || line.product.id !== this.env.pos.config.tip_product_id[0])); // We add the price as manually set to avoid recomputation when changing customer. const discount = (-pc / 100.0) * baseToDiscount;