Do not crash if weight is None.
This commit is contained in:
parent
377383b11a
commit
3de4337486
|
@ -119,7 +119,8 @@ class ShipmentOut(metaclass=PoolMeta):
|
||||||
weight = 1
|
weight = 1
|
||||||
if api.weight and hasattr(shipment, 'manual_weight'):
|
if api.weight and hasattr(shipment, 'manual_weight'):
|
||||||
weight = shipment.manual_weight or shipment.weight
|
weight = shipment.manual_weight or shipment.weight
|
||||||
weight = 1 if weight == 0.0 else weight
|
if not weight:
|
||||||
|
weight = 1
|
||||||
|
|
||||||
if api.weight_api_unit:
|
if api.weight_api_unit:
|
||||||
if shipment.weight_uom:
|
if shipment.weight_uom:
|
||||||
|
@ -129,7 +130,7 @@ class ShipmentOut(metaclass=PoolMeta):
|
||||||
weight = Uom.compute_qty(
|
weight = Uom.compute_qty(
|
||||||
api.weight_unit, weight, api.weight_api_unit)
|
api.weight_unit, weight, api.weight_api_unit)
|
||||||
|
|
||||||
# weight is integer value, not float
|
# weight must integer value, not float
|
||||||
weight = int(round(weight))
|
weight = int(round(weight))
|
||||||
weight = 1 if weight == 0 else weight
|
weight = 1 if weight == 0 else weight
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue