From ab245fcaa2338d6fe180c17fca7f6acc131a5a3a Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Mon, 25 Jan 2016 18:25:40 +0100 Subject: [PATCH] [FIX] stock_account: stock valuation at date total When performing a stock valuation at date, the stock valuation total wasn't equal to the sum of each line of the report. This is because the domain forcing the date wasn't passed to the `search` call when no group by was applied. Indeed, when calling `read_group` with a group by, the lines in the results contains the domain used for each line, but when there is no group by applied, this is not the case, the domain is not included in the line dict returned by `read_group`. In such a case, therefore, we must use the domain that was passed to the `read_group` call. opw-667761 --- addons/stock_account/wizard/stock_valuation_history.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock_account/wizard/stock_valuation_history.py b/addons/stock_account/wizard/stock_valuation_history.py index 71ff9950a2d..5fc94f8106f 100644 --- a/addons/stock_account/wizard/stock_valuation_history.py +++ b/addons/stock_account/wizard/stock_valuation_history.py @@ -50,7 +50,7 @@ class stock_history(osv.osv): if 'inventory_value' in fields: group_lines = {} for line in res: - domain = line.get('__domain', []) + domain = line.get('__domain', domain) group_lines.setdefault(str(domain), self.search(cr, uid, domain, context=context)) line_ids = set() for ids in group_lines.values(): @@ -75,7 +75,7 @@ class stock_history(osv.osv): histories_dict[(history['product_template_id'], history['company_id'])] = history['cost'] for line in res: inv_value = 0.0 - lines = group_lines.get(str(line.get('__domain', []))) + lines = group_lines.get(str(line.get('__domain', domain))) for line_id in lines: line_rec = lines_dict[line_id] product = products_dict[line_rec['product_id']]