diff options
| author | Simone Rubino <simone.rubino@agilebg.com> | 2018-10-09 17:18:09 +0200 |
|---|---|---|
| committer | Martin Trigaux <mat@odoo.com> | 2018-10-10 16:33:59 +0200 |
| commit | ba09b8989ebbe10aa336dbf850d075fbcda558d0 (patch) | |
| tree | 0868da709dd4a9a3f6293057804dcf3cc54c1684 /addons | |
| parent | 80d363cd31ec56b72e38e02571285349b60e428e (diff) | |
[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
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/stock_account/report/stock_history.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/stock_account/report/stock_history.py b/addons/stock_account/report/stock_history.py index 077aea8cef5..fabf4ff7add 100644 --- a/addons/stock_account/report/stock_history.py +++ b/addons/stock_account/report/stock_history.py @@ -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']] |
