From dd50d55b8d283934c2cb97849790a4da8c1f9c9b Mon Sep 17 00:00:00 2001 From: mtr Date: Thu, 18 Nov 2010 13:57:59 +0530 Subject: [PATCH 1/3] [IMP] Account: Partner Ledger Report-cummulative balance bzr revid: mtr@mtr-20101118082759-3sztv3si7sc5kztj --- addons/account/report/account_journal.py | 1 + addons/account/report/account_partner_ledger.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 82af01cdb0b..9bf5b026206 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -120,6 +120,7 @@ class journal_print(report_sxw.rml_parse, common_report_header): self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '',(tuple(move_state), period_id, tuple(journal_id) )) ids = map(lambda x: x[0], self.cr.fetchall()) + print"--ids--",ids return obj_mline.browse(self.cr, self.uid, ids) def _set_get_account_currency_code(self, account_id): diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index e66c3a9d523..79ae0ce83cf 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -152,8 +152,10 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): (partner.id, tuple(self.account_ids), tuple(move_state))) res = self.cr.dictfetchall() sum = 0.0 + if self.initial_balance: + sum = self.init_bal_sum for r in res: - sum = r['debit'] - r['credit'] + sum += r['debit'] - r['credit'] r['progress'] = sum full_account.append(r) return full_account @@ -178,7 +180,9 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): " " + RECONCILE_TAG + " "\ "AND " + self.init_query + " ", (partner.id, tuple(move_state), tuple(self.account_ids))) - return self.cr.fetchall() + res = self.cr.fetchall() + self.init_bal_sum = res[0][2] + return res def _sum_debit_partner(self, partner): move_state = ['draft','posted'] From f6616b83a664df826c62d7b34ccb98e5de353297 Mon Sep 17 00:00:00 2001 From: mtr Date: Fri, 19 Nov 2010 10:23:49 +0530 Subject: [PATCH 2/3] [IMP] Account:removed the print statement bzr revid: mtr@mtr-20101119045349-v1ww46vd0vkixz6m --- addons/account/report/account_journal.py | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/account/report/account_journal.py b/addons/account/report/account_journal.py index 9bf5b026206..82af01cdb0b 100644 --- a/addons/account/report/account_journal.py +++ b/addons/account/report/account_journal.py @@ -120,7 +120,6 @@ class journal_print(report_sxw.rml_parse, common_report_header): self.cr.execute('SELECT l.id FROM account_move_line l, account_move am WHERE l.move_id=am.id AND am.state IN %s AND l.period_id=%s AND l.journal_id IN %s ' + self.query_get_clause + ' ORDER BY l.'+ self.sort_selection + '',(tuple(move_state), period_id, tuple(journal_id) )) ids = map(lambda x: x[0], self.cr.fetchall()) - print"--ids--",ids return obj_mline.browse(self.cr, self.uid, ids) def _set_get_account_currency_code(self, account_id): From b058cbe6b44dde3c5fd068acb5b34826f46186dd Mon Sep 17 00:00:00 2001 From: mtr Date: Mon, 22 Nov 2010 12:26:42 +0530 Subject: [PATCH 3/3] [IMP] Account: declare a variable in __init__ method bzr revid: mtr@mtr-20101122065642-mpp9eru00zptxano --- addons/account/report/account_partner_ledger.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/report/account_partner_ledger.py b/addons/account/report/account_partner_ledger.py index 79ae0ce83cf..8d3bc8c55b0 100644 --- a/addons/account/report/account_partner_ledger.py +++ b/addons/account/report/account_partner_ledger.py @@ -28,6 +28,7 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header): def __init__(self, cr, uid, name, context=None): super(third_party_ledger, self).__init__(cr, uid, name, context=context) + self.init_bal_sum = 0.0 self.localcontext.update({ 'time': time, 'lines': self.lines,