From 42ba69bfa6b3f90d1fbfb32a664d8826223c9a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Mon, 25 Aug 2025 10:37:14 +0200 Subject: [PATCH] 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 --- 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 9648d997a4..9195bc820a 100644 --- a/modules/web_shop_shopify/sale.py +++ b/modules/web_shop_shopify/sale.py @@ -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: