[FIX] delivery: Delivery method without redirect on courier provider's website
A UserError must be sent if the delivery method set on the delivery order has no redirect on courier provider's website. opw:668960
This commit is contained in:
@@ -1074,6 +1074,12 @@ msgstr ""
|
||||
msgid "Shipment sent to carrier %s for expedition with tracking number %s"
|
||||
msgstr ""
|
||||
|
||||
#. module: delivery
|
||||
#: code:addons/delivery/models/stock_picking.py:106
|
||||
#, python-format
|
||||
msgid "Your delivery method has no redirect on courier provider's website to track this order."
|
||||
msgstr ""
|
||||
|
||||
#. module: delivery
|
||||
#: model:ir.model.fields,field_description:delivery.field_stock_picking_carrier_price
|
||||
msgid "Shipping Cost"
|
||||
|
||||
@@ -100,11 +100,15 @@ class StockPicking(models.Model):
|
||||
@api.multi
|
||||
def open_website_url(self):
|
||||
self.ensure_one()
|
||||
if self.carrier_id.get_tracking_link(self):
|
||||
url = self.carrier_id.get_tracking_link(self)[0]
|
||||
else:
|
||||
raise UserError(_("Your delivery method has no redirect on courier provider's website to track this order."))
|
||||
|
||||
client_action = {'type': 'ir.actions.act_url',
|
||||
'name': "Shipment Tracking Page",
|
||||
'target': 'new',
|
||||
'url': self.carrier_id.get_tracking_link(self)[0]
|
||||
'url': url,
|
||||
}
|
||||
return client_action
|
||||
|
||||
|
||||
Reference in New Issue
Block a user