From 1949b8bd997bfe0a5722aa4c6e5670dfc46efd28 Mon Sep 17 00:00:00 2001 From: Jay Vora Date: Mon, 29 Sep 2008 13:07:13 +0530 Subject: [PATCH] Account budget reports:Optimized code and bugfixes bzr revid: jvo@tinyerp.com-20080929073713-701e5q4qc8igfurh --- .../report/analytic_account_budget_report.py | 29 +++++++------------ .../report/crossovered_budget_report.py | 15 +++------- 2 files changed, 15 insertions(+), 29 deletions(-) diff --git a/addons/account_budget/report/analytic_account_budget_report.py b/addons/account_budget/report/analytic_account_budget_report.py index ea904caeda1..52ee37783fe 100644 --- a/addons/account_budget/report/analytic_account_budget_report.py +++ b/addons/account_budget/report/analytic_account_budget_report.py @@ -34,34 +34,27 @@ class analytic_account_budget_report(report_sxw.rml_parse): result=[] accounts = self.pool.get('account.analytic.account').browse(self.cr, self.uid, [object.id], self.context.copy()) + c_b_lines_obj=self.pool.get('crossovered.budget.lines') for account_id in accounts: res={} - budget_lines=[] b_line_ids=[] for line in account_id.crossovered_budget_line: b_line_ids.append(line.id) + if not b_line_ids: + return [] + bd_lines_ids = ','.join([str(x) for x in b_line_ids]) d_from=form['date_from'] d_to=form['date_to'] - query="select id from crossovered_budget_lines where id in ("+ str(bd_lines_ids) + ")"# AND '"+ str(d_from) +"'<=date_from AND date_from