Skip to content
Snippets Groups Projects
Commit ab245fca authored by Denis Ledoux's avatar Denis Ledoux
Browse files

[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
parent 11fe2d5b
Branches
Tags
No related merge requests found
......@@ -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']]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment