diff --git a/modules/web_shop/CHANGELOG b/modules/web_shop/CHANGELOG
index 82fa2438fe..916c71e2fd 100644
--- a/modules/web_shop/CHANGELOG
+++ b/modules/web_shop/CHANGELOG
@@ -1,3 +1,4 @@
+* Add a status URL to sales
* Add button to update the sales from their web shop
* Add web shop URLs to products
diff --git a/modules/web_shop/sale.py b/modules/web_shop/sale.py
index 68df3ffeb3..9136f68131 100644
--- a/modules/web_shop/sale.py
+++ b/modules/web_shop/sale.py
@@ -23,6 +23,15 @@ class Sale(metaclass=PoolMeta):
'required': Bool(Eval('web_shop')),
'readonly': ~Eval('web_id'),
})
+ web_status_url = fields.Function(
+ fields.Char(
+ "Web Status URL",
+ states={
+ 'invisible': ~Eval('web_status_url'),
+ },
+ help="The URL where the customer can check "
+ "the order's current status."),
+ 'get_web_status_url')
@classmethod
def __setup__(cls):
@@ -55,6 +64,9 @@ class Sale(metaclass=PoolMeta):
if self.web_shop and not self.web_id:
self.web_id = token_hex(nbytes)
+ def get_web_status_url(self, name):
+ pass
+
@classmethod
def copy(cls, sales, default=None):
if default is None:
diff --git a/modules/web_shop/view/sale_form.xml b/modules/web_shop/view/sale_form.xml
index 7c6079c81b..661fefc54b 100644
--- a/modules/web_shop/view/sale_form.xml
+++ b/modules/web_shop/view/sale_form.xml
@@ -7,6 +7,9 @@ this repository contains the full copyright notices and license terms. -->
+
+
+
diff --git a/modules/web_shop_shopify/sale.py b/modules/web_shop_shopify/sale.py
index d723327b08..0d8fc947c6 100644
--- a/modules/web_shop_shopify/sale.py
+++ b/modules/web_shop_shopify/sale.py
@@ -27,6 +27,7 @@ class Sale(IdentifierMixin, metaclass=PoolMeta):
shopify_tax_adjustment = Monetary(
"Shopify Tax Adjustment",
currency='currency', digits='currency', readonly=True)
+ shopify_status_url = fields.Char("Shopify Status URL", readonly=True)
@classmethod
def __setup__(cls):
@@ -38,6 +39,12 @@ class Sale(IdentifierMixin, metaclass=PoolMeta):
'web_shop_shopify.msg_identifier_sale_web_shop_unique'),
]
+ def get_web_status_url(self, name):
+ url = super().get_web_status_url(name)
+ if self.shopify_status_url:
+ url = self.shopify_status_url
+ return url
+
@fields.depends('shopify_tax_adjustment')
def get_tax_amount(self):
amount = super().get_tax_amount()
@@ -108,6 +115,7 @@ class Sale(IdentifierMixin, metaclass=PoolMeta):
sale.invoice_address = address
setattr_changed(sale, 'reference', order.name)
+ setattr_changed(sale, 'shopify_status_url', order.order_status_url)
setattr_changed(sale, 'comment', order.note)
setattr_changed(sale, 'sale_date', dateutil.parser.isoparse(
order.processed_at or order.created_at).date())
diff --git a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst
index 8b2f43cc58..2684c2931d 100644
--- a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst
+++ b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst
@@ -519,6 +519,7 @@ Run fetch order::
>>> assertEqual(sale.party.phone.replace(' ', ''), customer_phone.replace('-', ''))
>>> len(sale.party.contact_mechanisms)
2
+ >>> assertTrue(sale.web_status_url)
Capture full amount::