From c6758b2b2fac652149e2a5f60d52335a1a370ddf Mon Sep 17 00:00:00 2001 From: rde <> Date: Thu, 11 Jan 2007 08:58:27 +0000 Subject: [PATCH] bzr revid: rde-d76c033a9f00a23a1275174c9eabc1fd39c81f0a --- .../project/report/account_analytic_budget_report.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/addons/account/project/report/account_analytic_budget_report.py b/addons/account/project/report/account_analytic_budget_report.py index 3ed3c8c270c..28cd70b8cdd 100644 --- a/addons/account/project/report/account_analytic_budget_report.py +++ b/addons/account/project/report/account_analytic_budget_report.py @@ -60,12 +60,22 @@ class account_analytic_budget_report(report_sxw.rml_parse): res[k] += r[k] return [res] + def lines_rec(self, post_obj, date1, date2): + res = [] + for a in post_obj.account_ids: + self.cr.execute("SELECT COALESCE(SUM(debit-credit), 0) FROM account_move_line WHERE account_id=%d AND date>=%s AND date<=%s and state<>'draft'", (a.id, date1, date2)) + achievements = float(self.cr.fetchone()[0]) * (post_obj.sens=='produit' and -1 or 1) + res.append({'name': a.name, 'code': a.code, 'achievements': achievements}) + for c in a.child_ids: # FIXME : JUST AN IDEA doesn't work + res.extend(lines_rec(post_obj, date1, date2)) + def lines(self, post_obj, date1, date2): res = [] for a in post_obj.account_ids: self.cr.execute("SELECT COALESCE(SUM(debit-credit), 0) FROM account_move_line WHERE account_id=%d AND date>=%s AND date<=%s and state<>'draft'", (a.id, date1, date2)) achievements = float(self.cr.fetchone()[0]) * (post_obj.sens=='produit' and -1 or 1) res.append({'name': a.name, 'code': a.code, 'achievements': achievements}) + return res report_sxw.report_sxw('report.account.analytic.budget.print', 'account.analytic.budget.post', 'addons/account/project/report/account_analytic_budget_report.rml',parser=account_analytic_budget_report)