From 4fa700af44b345b2a905468e7bfcc83726f9a901 Mon Sep 17 00:00:00 2001 From: apa-tiny Date: Thu, 23 Oct 2008 16:19:37 +0530 Subject: [PATCH] General Ledger Report : it crashes, the report does not open Nothing appears on the server but the PDF do not opens bzr revid: patelamit2003@gmail.com-20081023104937-0zid1zap38qiq60v --- addons/account/report/general_ledger.py | 7 +++++-- .../wizard/wizard_general_ledger_report.py | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/addons/account/report/general_ledger.py b/addons/account/report/general_ledger.py index 57a355f4f93..c27f3fcee24 100755 --- a/addons/account/report/general_ledger.py +++ b/addons/account/report/general_ledger.py @@ -32,6 +32,7 @@ from report import report_sxw import xml import rml_parse import pooler +from osv import osv class general_ledger(rml_parse.rml_parse): _name = 'report.account.general.ledger' @@ -135,9 +136,12 @@ class general_ledger(rml_parse.rml_parse): for child_id in self.pool.get('account.account').search(self.cr, self.uid, [('parent_id', 'child_of', [account.id])]): + child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) + sold_account = self._sum_solde_account(child_account,form) self.sold_accounts[child_account.id] = sold_account + if form['display_account'] == 'bal_mouvement': if child_account.type != 'view' \ and len(self.pool.get('account.move.line').search(self.cr, self.uid, @@ -163,7 +167,6 @@ class general_ledger(rml_parse.rml_parse): ## We will now compute solde initiaux - for move in res: SOLDEINIT = "SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l WHERE l.account_id = " + str(move.id) + " AND l.date <= '" + self.borne_date['max_date'] + "'" + " AND l.date >= '" + self.borne_date['min_date'] + "'" @@ -188,7 +191,7 @@ class general_ledger(rml_parse.rml_parse): else: move.init_credit = 0 move.init_debit = 0 - + ## return res diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py index 0bfec00f87b..5dab0f59744 100644 --- a/addons/account/wizard/wizard_general_ledger_report.py +++ b/addons/account/wizard/wizard_general_ledger_report.py @@ -145,6 +145,20 @@ def _check_date(self, cr, uid, data, context): raise wizard.except_wizard('UserError','Date not in a defined fiscal year') def _check_state(self, cr, uid, data, context): + print"data",data + my_ids=data['ids'] + if data['model']!='account.account': + my_ids=[data['form']['Account_list']] + + child_ids = pooler.get_pool(cr.dbname).get('account.account').search(cr, uid,[('parent_id', 'child_of',my_ids )]) + + for child in child_ids : + child_account = pooler.get_pool(cr.dbname).get('account.account').browse(cr, uid, child) + res = pooler.get_pool(cr.dbname).get('account.move.line').search(cr, uid,[('account_id','=',child_account.id)]) + print"res",res + if not len(res): + raise wizard.except_wizard('UserError',"Make sure the account you select has children accounts.") + if data['form']['state'] == 'bydate': data['form']['fiscalyear'] = False else : @@ -190,7 +204,7 @@ class wizard_report(wizard.interface): 'result': {'type':'choice','next_state':_check} }, 'report_landscape': { - 'actions': [], + 'actions': [_check_state], 'result': {'type':'print', 'report':'account.general.ledger_landscape', 'state':'end'} }, 'report': {