@@ -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
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -7,6 +7,9 @@ this repository contains the full copyright notices and license terms. -->
|
||||
<field name="web_shop"/>
|
||||
<label name="web_id"/>
|
||||
<field name="web_id"/>
|
||||
|
||||
<label name="web_status_url"/>
|
||||
<field name="web_status_url" widget="url" colspan="3"/>
|
||||
</xpath>
|
||||
<xpath expr="//button[@name='process']" position="after">
|
||||
<button name="web_shop_update"/>
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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::
|
||||
|
||||
|
||||
Reference in New Issue
Block a user