From 64a219bd0694c6e7f79692f8d1dfd2201f6125e1 Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Mon, 6 Aug 2018 14:43:28 +0200 Subject: [PATCH] [FIX] stock: multiple orderpoints for a same location commit 47654e98e0ae0ba91b7972cd113be364b7c9862f modified a defaultdict by an OrderedDict. When multiple orderpoints use the same location the key is the same and location_data dict entry is removed for the new one. This commit only call makedefault when there is not current entry for the dict. --- addons/stock/models/procurement.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock/models/procurement.py b/addons/stock/models/procurement.py index ce6e16d58f4..405c4f4c318 100644 --- a/addons/stock/models/procurement.py +++ b/addons/stock/models/procurement.py @@ -339,7 +339,8 @@ class ProcurementGroup(models.Model): for orderpoint in orderpoints: key = self._procurement_from_orderpoint_get_grouping_key([orderpoint.id]) - location_data[key] = makedefault() + if not location_data.get(key): + location_data[key] = makedefault() location_data[key]['products'] += orderpoint.product_id location_data[key]['orderpoints'] += orderpoint location_data[key]['groups'] = self._procurement_from_orderpoint_get_groups([orderpoint.id])