[FIX] stock_account: group on empty field

65;5401;1c
Line contains the value returned by a select clause on inventory lines.
postgresql result returns None instead of False when no value is set.

Avoid having a stock_histories_by_group dict with a key to None

Having a None value is problematic as the key is used based on the read_group
result returned by the super call above.

e.g. grouping the inventory history by lot numbers, while some moves have no
inventory, used to produce a KeyError

Closes #27591
This commit is contained in:
Simone Rubino
2018-10-10 16:33:59 +02:00
committed by Martin Trigaux
parent 80d363cd31
commit ba09b8989e
+1 -1
View File
@@ -53,7 +53,7 @@ class StockHistory(models.Model):
stock_histories_by_group = {}
for line in self._cr.dictfetchall():
stock_history_data[line['id']] = line
key = tuple(line[g] if g in line else False for g in groupby_list)
key = tuple(line.get(g) or False for g in groupby_list)
stock_histories_by_group.setdefault(key, [])
stock_histories_by_group[key] += [line['id']]