make sure tracking number is always set, even if there is none

Depending on the product used, there is no tracking number.  However,
the odoo shipping infrastructure expects us to return one.

Also, add a bogus space at the beginning of the tracking number, as odoo
shipping infrastructure removes the first character ?!?
This commit is contained in:
Harald Welte 2016-07-15 16:49:34 +02:00
parent 0b16804bcb
commit 77f0962743
1 changed files with 5 additions and 2 deletions

View File

@ -89,10 +89,13 @@ class DPDeliveryCarrier(models.Model):
r = im.checkoutPNG()
voucher = r.shoppingCart.voucherList.voucher[0]
filename = 'DP'+voucher.trackId+'.png'
result = { 'exact_price': im.compute_total(),
tracking_nr = ' '
if voucher.trackId:
tracking_nr += voucher.trackId
result = { 'exact_price': im.compute_total()/100,
'weight': service.weight,
'date_delivery': None,
'tracking_number': voucher.trackId,
'tracking_number': tracking_nr,
'voucher_id' : voucher.voucherId,
'order_id' : r.shoppingCart.shopOrderId,
'wallet_balance': r.walletBalance,