Use line item quantity to calculate unit price of Shopify sale line

The total discount is based on the initial quantity of the line item instead of
the current quantity.

Closes #14187
This commit is contained in:
Cédric Krier
2025-08-25 10:37:14 +02:00
parent 7f0cb85631
commit 42ba69bfa6
+2 -2
View File
@@ -392,9 +392,9 @@ class Line(IdentifierMixin, metaclass=PoolMeta):
total_discount = sum(
Decimal(d.amount) for d in line_item.discount_allocations)
unit_price = ((
(Decimal(line_item.price) * (quantity or 1))
(Decimal(line_item.price) * (line_item.quantity or 1))
- Decimal(total_discount))
/ (quantity or 1))
/ (line_item.quantity or 1))
unit_price = round_price(Tax.reverse_compute(
unit_price, line.taxes, sale.sale_date))
if line.product: