Use quantity set on the line to compute unit price from Shopify order

The quantity of the line item may be different if part of the line item has
been refunded or cancelled.

Closes #14103
This commit is contained in:
Cédric Krier
2025-07-04 10:15:23 +02:00
parent aa0bf2e7ba
commit bf18b966b8
+2 -2
View File
@@ -373,9 +373,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) * line_item.quantity)
(Decimal(line_item.price) * (quantity or 1))
- Decimal(total_discount))
/ line_item.quantity)
/ (quantity or 1))
unit_price = round_price(Tax.reverse_compute(
unit_price, line.taxes, sale.sale_date))
if line.product: