fix inquiry (no pickings, and hence no packaging_tare)

This commit is contained in:
Harald Welte 2021-02-15 20:13:19 +01:00
parent 1338359e24
commit 3001d7a8de
1 changed files with 2 additions and 1 deletions

View File

@ -87,13 +87,14 @@ class SCDeliveryCarrier(models.Model):
"""Convert an Odoo stock.picking or sale.order into a shipcloud package"""
pkg = {}
pkg['type'] = 'parcel'
pkg['weight'] = self._get_weight_with_tare(order, picking)
if picking:
pkg['weight'] = self._get_weight_with_tare(order, picking)
pkg['length'] = picking.packaging_length
pkg['width'] = picking.packaging_width
pkg['height'] = picking.packaging_height
else:
# we assume an average mass density of 0.5kg per dm3 (litre)
pkg['weight'] = self._get_weight(order, picking)
est = self.estimate_dimensions(pkg['weight'], 0.5)
pkg['length'] = est[0]
pkg['width'] = est[1]