[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:
@@ -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']]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user