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
(grafted from 98b1e09aecad37afc1c9ae630f855d46da96b640)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier committed 2025-07-04 10:15:23 +02:00
1 parent b80eb0af20
commit 74a7ee5a1d
1 file changed
+2 -2
+2 -2
View File
@@ -359,9 +359,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: