details:   https://code.tryton.org/tryton/commit/bbd83750852b
branch:    default
user:      Cédric Krier <[email protected]>
date:      Fri Feb 20 17:50:02 2026 +0100
description:
        Manage payment terms from Shopify

        The sale is always confirmed when the Shopify order has payment terms.

        Closes #14619
diffstat:

 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(+), 0 deletions(-)

diffs (67 lines):

diff -r dccdca1b6902 -r bbd83750852b modules/web_shop_shopify/CHANGELOG
--- a/modules/web_shop_shopify/CHANGELOG        Mon Feb 16 10:49:41 2026 +0100
+++ b/modules/web_shop_shopify/CHANGELOG        Fri Feb 20 17:50:02 2026 +0100
@@ -1,3 +1,4 @@
+* Manage payment terms
 
 Version 7.8.0 - 2025-12-15
 --------------------------
diff -r dccdca1b6902 -r bbd83750852b modules/web_shop_shopify/doc/usage.rst
--- a/modules/web_shop_shopify/doc/usage.rst    Mon Feb 16 10:49:41 2026 +0100
+++ b/modules/web_shop_shopify/doc/usage.rst    Fri Feb 20 17:50:02 2026 +0100
@@ -26,6 +26,8 @@
 
    * :guilabel:`Orders`: ``write_orders``
 
+   * :guilabel:`Payment terms`: ``read_payment_terms``
+
    * :guilabel:`Product listings`: ``write_product_listings``
 
    * :guilabel:`Products`: ``write_products``
diff -r dccdca1b6902 -r bbd83750852b modules/web_shop_shopify/sale.py
--- a/modules/web_shop_shopify/sale.py  Mon Feb 16 10:49:41 2026 +0100
+++ b/modules/web_shop_shopify/sale.py  Fri Feb 20 17:50:02 2026 +0100
@@ -153,6 +153,9 @@
     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 @@
                     'endCursor': None,
                     }
                 },
+            'paymentTerms': {
+                'paymentTermsType': None,
+                },
             'transactions': Payment.shopify_fields(),
             'totalPriceSet': {
                 'presentmentMoney': {
@@ -488,8 +494,23 @@
             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

Reply via email to