From c4e650df5361224d68fd0683355629d1354876d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 15 Jun 2022 22:05:41 +0200 Subject: [PATCH] Store allocation factors per model name and id This avoid collision if different shipment models have the same id. issue11559 review443231004 --- account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/account.py b/account.py index 1a0be6e116..5b3488d1f6 100644 --- a/account.py +++ b/account.py @@ -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