[FIX] delivery: traceback on single tracker
When using easypost, it could exist more than one tracking link. In this case they are stored as a json and the method open_url try to load it as a list of url. Then it checks if there is more than one url or not. However in a single case, there is only one string and the lenght of a string is the number of chracter inside that is often more than one.
This commit is contained in:
@@ -184,21 +184,20 @@ class StockPicking(models.Model):
|
||||
carrier_trackers = json.loads(self.carrier_tracking_url)
|
||||
except ValueError:
|
||||
carrier_trackers = self.carrier_tracking_url
|
||||
|
||||
if len(carrier_trackers) > 1:
|
||||
else:
|
||||
msg = "Tracking links for shipment: <br/>"
|
||||
for tracker in carrier_trackers:
|
||||
msg += '<a href=' + tracker[1] + '>' + tracker[0] + '</a><br/>'
|
||||
self.message_post(body=msg)
|
||||
return self.env.ref('delivery.act_delivery_trackers_url').read()[0]
|
||||
else:
|
||||
client_action = {
|
||||
'type': 'ir.actions.act_url',
|
||||
'name': "Shipment Tracking Page",
|
||||
'target': 'new',
|
||||
'url': self.carrier_tracking_url,
|
||||
}
|
||||
return client_action
|
||||
|
||||
client_action = {
|
||||
'type': 'ir.actions.act_url',
|
||||
'name': "Shipment Tracking Page",
|
||||
'target': 'new',
|
||||
'url': self.carrier_tracking_url,
|
||||
}
|
||||
return client_action
|
||||
|
||||
@api.one
|
||||
def cancel_shipment(self):
|
||||
|
||||
@@ -302,7 +302,7 @@
|
||||
<form string="Trackers URL">
|
||||
<group>
|
||||
<div class="alert alert-info">
|
||||
<p>You have multiple URL, they should be available in the chatter.</p>
|
||||
<p>You have multiple tracker links, they are available in the chatter.</p>
|
||||
</div>
|
||||
</group>
|
||||
<footer>
|
||||
|
||||
Reference in New Issue
Block a user