From e79353e08a2944dcc9080ec33637c3f88128a350 Mon Sep 17 00:00:00 2001 From: Humberto Arocha Date: Fri, 27 Jul 2012 02:53:27 -0530 Subject: [PATCH] [IMP] Ahora El signo del reporte se muestra de acuerdo a la naturaleza de la cuenta --- .../report/balance_full_4_cols.rml | 4 ++-- account_financial_report/report/parser.py | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/account_financial_report/report/balance_full_4_cols.rml b/account_financial_report/report/balance_full_4_cols.rml index 1004de65..24e99016 100644 --- a/account_financial_report/report/balance_full_4_cols.rml +++ b/account_financial_report/report/balance_full_4_cols.rml @@ -122,7 +122,7 @@ [[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]] - [[ (a['total']==True) and formatLang(a['balanceinit'], digits=2, grouping=True) or '']] + [[ (a['total']==True) and formatLang(a['balanceinit'] and a['balanceinit'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']] @@ -140,7 +140,7 @@ [[ a['type']<>'view' and setTag('para','para',{'fontName':"Courier"}) or removeParentNode('font') ]] - [[ (a['total']==True) and formatLang(a['balance'], digits=2, grouping=True) or '']] + [[ (a['total']==True) and formatLang(a['balance'] and a['balance'] * a.get('change_sign') or 0.0, digits=2, grouping=True) or '']] diff --git a/account_financial_report/report/parser.py b/account_financial_report/report/parser.py index b25f244a..e8c1e42b 100644 --- a/account_financial_report/report/parser.py +++ b/account_financial_report/report/parser.py @@ -149,6 +149,10 @@ class account_balance(report_sxw.rml_parse): rc_obj = self.pool.get('res.company') return rc_obj.browse(self.cr, self.uid, company_id).currency_id.id + def get_company_credit_accounts(self, company_id): + rc_obj = self.pool.get('res.company') + return [brw.id for brw in rc_obj.browse(self.cr, self.uid, company_id).credit_account_ids] + def lines(self, form, level=0): """ Returns all the data needed for the report lines @@ -169,7 +173,11 @@ class account_balance(report_sxw.rml_parse): if form.has_key('account_list') and form['account_list']: account_ids = form['account_list'] del form['account_list'] - credit_account_ids = account_ids + + credit_account_ids = self.get_company_credit_accounts(form['company_id'] and type(form['company_id']) in (list,tuple) and form['company_id'][0] or form['company_id']) + + print 'Primer print de credit_account_ids ', credit_account_ids + res = {} result_acc = [] accounts_levels = {} @@ -328,6 +336,7 @@ class account_balance(report_sxw.rml_parse): 'bal_type': '', 'label': account['label'], 'total': account['total'], + 'change_sign' : credit_account_ids and (account_id in credit_account_ids and -1 or 1) or 1 } # # Round the values to zero if needed (-0.000001 ~= 0)