From 00c723b0eb6887e2fa082e82665f562cd7f0d9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 20 Feb 2026 17:50:02 +0100 Subject: [PATCH] Manage payment terms from Shopify The sale is always confirmed when the Shopify order has payment terms. Closes #14619 --- modules/web_shop_shopify/CHANGELOG | 1 + modules/web_shop_shopify/doc/usage.rst | 2 ++ modules/web_shop_shopify/sale.py | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/modules/web_shop_shopify/CHANGELOG b/modules/web_shop_shopify/CHANGELOG index 4be813343b..8161a16466 100644 --- a/modules/web_shop_shopify/CHANGELOG +++ b/modules/web_shop_shopify/CHANGELOG @@ -1,3 +1,4 @@ +* Manage payment terms Version 7.8.0 - 2025-12-15 -------------------------- diff --git a/modules/web_shop_shopify/doc/usage.rst b/modules/web_shop_shopify/doc/usage.rst index c64a591680..57dc02db67 100644 --- a/modules/web_shop_shopify/doc/usage.rst +++ b/modules/web_shop_shopify/doc/usage.rst @@ -26,6 +26,8 @@ with, as a minimum, the :guilabel:`Admin API access scopes`: * :guilabel:`Orders`: ``write_orders`` + * :guilabel:`Payment terms`: ``read_payment_terms`` + * :guilabel:`Product listings`: ``write_product_listings`` * :guilabel:`Products`: ``write_products`` diff --git a/modules/web_shop_shopify/sale.py b/modules/web_shop_shopify/sale.py index 96471f21cb..1175d07b49 100644 --- a/modules/web_shop_shopify/sale.py +++ b/modules/web_shop_shopify/sale.py @@ -153,6 +153,9 @@ class Sale(IdentifierMixin, metaclass=PoolMeta): shopify_tax_adjustment = Monetary( "Shopify Tax Adjustment", currency='currency', digits='currency', readonly=True) + shopify_amount_to_pay = Monetary( + "Shopify Amount to Pay", + currency='currency', digits='currency', readonly=True) shopify_status_url = fields.Char("Shopify Status URL", readonly=True) shopify_resource = 'orders' @@ -267,6 +270,9 @@ class Sale(IdentifierMixin, metaclass=PoolMeta): 'endCursor': None, } }, + 'paymentTerms': { + 'paymentTermsType': None, + }, 'transactions': Payment.shopify_fields(), 'totalPriceSet': { 'presentmentMoney': { @@ -488,8 +494,23 @@ class Sale(IdentifierMixin, metaclass=PoolMeta): line.quantity = 0 lines.append(line) sale.lines = lines + setattr_changed( + sale, 'shopify_amount_to_pay', + cls._shopify_amount_to_pay(order)) return sale + @classmethod + def _shopify_amount_to_pay(cls, order): + if order['paymentTerms']: + return 0 + + @property + def amount_to_pay(self): + amount = super().amount_to_pay + if self.shopify_amount_to_pay is not None: + amount = self.shopify_amount_to_pay + return amount + @property def invoice_grouping_method(self): method = super().invoice_grouping_method