Store allocation factors per model name and id

This avoid collision if different shipment models have the same id.

issue11559
review443231004
This commit is contained in:
Cédric Krier committed 2022-06-15 22:05:41 +02:00
1 parent 48ef0ebe27
commit c4e650df53
1 file changed
+2 -2
+2 -2
View File
@@ -29,8 +29,8 @@ class ShipmentCost(metaclass=PoolMeta):
factors = {}
for shipment in shipments:
if not sum_weight:
factors[str(shipment.id)] = 1 / length
factors[str(shipment)] = 1 / length
else:
factors[str(shipment.id)] = (
factors[str(shipment)] = (
Decimal(shipment.weight or 0) / sum_weight)
return factors