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:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user