Skip to content
Snippets Groups Projects
Unverified Commit 1b15aa59 authored by Richard deMeester's avatar Richard deMeester Committed by Martin Trigaux
Browse files

[FIX] account_budget: reset correctly result variable

If a budget line has no analytic account id, the code is intentional
about returning a value of 0 for it.  It is possible, that in some
cases, depending on the order of lines processed, the routine returns
the previous value, as it does not initialise an important
variable on each iteration of the loop.

Closes #13303
parent a8614327
Branches
Tags
No related merge requests found
......@@ -95,7 +95,6 @@ class crossovered_budget_lines(osv.osv):
def _prac_amt(self, cr, uid, ids, context=None):
res = {}
result = 0.0
if context is None:
context = {}
for line in self.browse(cr, uid, ids, context=context):
......@@ -109,8 +108,10 @@ class crossovered_budget_lines(osv.osv):
"between to_date(%s,'yyyy-mm-dd') AND to_date(%s,'yyyy-mm-dd')) AND "
"general_account_id=ANY(%s)", (line.analytic_account_id.id, date_from, date_to,acc_ids,))
result = cr.fetchone()[0]
if result is None:
result = 0.00
if result is None:
result = 0.0
else:
result = 0.0
res[line.id] = result
return res
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment