From bf18b966b8920b0afc51ef5dfdbd4b80656ecbfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 4 Jul 2025 10:15:23 +0200 Subject: [PATCH] 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 --- modules/web_shop_shopify/sale.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/web_shop_shopify/sale.py b/modules/web_shop_shopify/sale.py index dc2c4249fa..6aa908e5c8 100644 --- a/modules/web_shop_shopify/sale.py +++ b/modules/web_shop_shopify/sale.py @@ -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: