From 1b15aa590b83265794224cdd8e2da8ecc70044b8 Mon Sep 17 00:00:00 2001 From: Richard deMeester Date: Fri, 26 Aug 2016 15:50:38 +1000 Subject: [PATCH] [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 --- addons/account_budget/account_budget.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addons/account_budget/account_budget.py b/addons/account_budget/account_budget.py index 4537dbf1743..6056a657ab5 100644 --- a/addons/account_budget/account_budget.py +++ b/addons/account_budget/account_budget.py @@ -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