Manage payment terms from Shopify
The sale is always confirmed when the Shopify order has payment terms. Closes #14619
This commit is contained in:
1 parent
a3493a3f2f
commit
00c723b0eb
3 files changed
+24
No files matched your search
@@ -1,3 +1,4 @@
|
||||
* Manage payment terms
|
||||
|
||||
Version 7.8.0 - 2025-12-15
|
||||
--------------------------
|
||||
|
||||
@@ -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``
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user