From 91af0fb67823bbf293b2b8f9a7b2ce09d7b30f46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 15 Sep 2026 12:04:11 +0200 Subject: [PATCH] Do not set non salable product on sale line when synchronise with Shopify Closes #15096 (grafted from 61fc72015b9b1b77c437260145170bd4b6a75140) --HG-- branch : 8.0 --- modules/web_shop_shopify/sale.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/modules/web_shop_shopify/sale.py b/modules/web_shop_shopify/sale.py index 1867a204be..7b0cd6cc43 100644 --- a/modules/web_shop_shopify/sale.py +++ b/modules/web_shop_shopify/sale.py @@ -829,13 +829,17 @@ class Sale_ShipmentCost(metaclass=PoolMeta): carrier = None if shipment_cost_method and (shipping_line := order['shippingLine']): available_carriers = self.on_change_with_available_carriers() + first_carrier = None for carrier in available_carriers: + if not carrier.carrier_product.salable: + continue if carrier.shopify_match(shop, shipping_line): carrier = carrier break + elif first_carrier is None: + first_carrier = carrier else: - if available_carriers: - carrier = available_carriers[0] + carrier = first_carrier if not carrier: shipment_cost_method = None setattr_changed(self, 'carrier', carrier) @@ -903,7 +907,8 @@ class Line(IdentifierMixin, metaclass=PoolMeta): if line_item['variant'] and line_item['variant']['id']: if product := Product.search_shopify_identifier( sale.web_shop, gid2id(line_item['variant']['id'])): - setattr_changed(line, 'product', product) + if product.salable: + setattr_changed(line, 'product', product) if line.product: line._set_shopify_quantity(line.product, quantity) if line._changed_values():