[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) <jcb@odoo.com>
Signed-off-by: Engels Robin (roen) <roen@odoo.com>
This commit is contained in:
roen-odoo
2023-05-11 16:01:19 +02:00
parent fb454477c6
commit b13e9f5fdd
@@ -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;