odoo/odoo#161817

Created by Mathys Paul (matp)
label
odoo-dev:16.0-website_sale-error-remove-promo-from-cart-matp
head
77b2af36cbad59ea175ac2a217f1a8076500da0a
target
16.0
merged
3 weeks ago by Sales, Victor Feyens (vfe)
forward-ports

[FIX] website_sale_loyalty: Fix coupon deletion

Resolves a problem when removing a coupon from an order containing different tax applications.

If an order is composed of products with varying tax rates, the coupon applied generates separate lines for each unique tax situation. This includes non-taxed products, products with individual taxes, and combinations thereof.

The purpose of this commit is to fix the management of coupon deletion in cases where the coupon generates multiple lines for different tax scenarios. Adjusting the recovery process to select the first coupon line identifier, ensuring that the correct line is targeted for deletion in scenarios with multiple tax-related coupon lines.

Example:
- Product A (non-taxed)
- Product B (Tax A)
- Product C (Tax B)
- Product D (Tax A and B)

The coupon would generate four separate lines for non-taxed, Tax A, Tax B, and Tax A & B scenarios, respectively.

opw-3693319