fix obtaining a quote (no picking yet)

when we obtain a shipping quote from an SO in quote state, we do
not yet have a picking and hence cannot unconditionally dereference
the picking object in the build_sc_pkg() method.

Related: SYS#6648
This commit is contained in:
Harald Welte 2023-11-29 17:45:06 +01:00
parent 38c2442567
commit c8ec521f9a
1 changed files with 1 additions and 1 deletions

View File

@ -93,12 +93,12 @@ class SCDeliveryCarrier(models.Model):
"""Convert an Odoo stock.picking or sale.order into a shipcloud package"""
pkg = {}
pkg['type'] = 'parcel'
pkg['description'] = picking.sc_content_desc
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
pkg['description'] = picking.sc_content_desc
else:
# we assume an average mass density of 0.5kg per dm3 (litre)
pkg['weight'] = self._get_weight(order, picking)