diff --git a/account_financial_report/report/account_balance.py b/account_financial_report/report/account_balance.py index 7f67652c..89339504 100644 --- a/account_financial_report/report/account_balance.py +++ b/account_financial_report/report/account_balance.py @@ -39,7 +39,6 @@ class account_balance(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - print 'INICIO: ',datetime.datetime.now() super(account_balance, self).__init__(cr, uid, name, context) self.sum_debit = 0.00 self.sum_credit = 0.00 @@ -198,10 +197,22 @@ class account_balance(report_sxw.rml_parse): ctx['date_to'] = form['date_to'] accounts=[] + val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) + c = 0 for aa_id in account_ids: - new_acc = account_obj.read(self.cr, self.uid, aa_id[0], ['type','code','name','balance','parent_id','level'], ctx) - new_acc.update({'label':aa_id[1],'total':aa_id[2]}) - accounts.append(new_acc) + new_acc = { + 'id' :val[c].id, + 'type' :val[c].type, + 'code' :val[c].code, + 'name' :val[c].name, + 'balance' :val[c].balance, + 'parent_id' :val[c].parent_id and val[c].parent_id.id, + 'level' :val[c].level, + 'label' :aa_id[1], + 'total' :aa_id[2], + } + c += 1 + accounts.append(new_acc) # # Generate the report lines (checking each account) @@ -266,7 +277,6 @@ class account_balance(report_sxw.rml_parse): if form['tot_check'] and res['type'] == 'view' and res['level'] == 1 and (res['id'] not in tot): tot[res['id']] = True tot_eje += res['balance'] - print 'FIN: ',datetime.datetime.now() if form['tot_check']: str_label = form['lab_str'] res2 = { @@ -280,6 +290,6 @@ class account_balance(report_sxw.rml_parse): return result_acc report_sxw.report_sxw('report.account.account.balance.gene', 'wizard.report.account.balance.gene', - 'addons/l10n_co_account_financial_report/report/balance_full.rml', + 'account_financial_report/report/balance_full.rml', parser=account_balance, header=False) diff --git a/account_financial_report/report/account_balance_2_cols.py b/account_financial_report/report/account_balance_2_cols.py index 393ead94..7ead2a03 100644 --- a/account_financial_report/report/account_balance_2_cols.py +++ b/account_financial_report/report/account_balance_2_cols.py @@ -39,7 +39,6 @@ class account_balance(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - print 'INICIO: ',datetime.datetime.now() super(account_balance, self).__init__(cr, uid, name, context) self.sum_debit = 0.00 self.sum_credit = 0.00 @@ -92,7 +91,7 @@ class account_balance(report_sxw.rml_parse): fiscalyear_id = form['fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) period_ids = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear_id),('special','=',False)]) if form['state'] in ['byperiod', 'all']: - period_ids = form['periods'][0][2] + period_ids = form['periods'] periods_str = ', '.join([period.name or period.code for period in period_obj.browse(self.cr, self.uid, period_ids)]) dates_str = None @@ -174,10 +173,23 @@ class account_balance(report_sxw.rml_parse): ctx['date_to'] = form['date_to'] accounts=[] + val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) + c = 0 for aa_id in account_ids: - new_acc = account_obj.read(self.cr, self.uid, aa_id[0], ['type','code','name','debit','credit','parent_id','level'], ctx) - new_acc.update({'label':aa_id[1],'total':aa_id[2]}) - accounts.append(new_acc) + new_acc = { + 'id' :val[c].id, + 'type' :val[c].type, + 'code' :val[c].code, + 'name' :val[c].name, + 'debit' :val[c].debit, + 'credit' :val[c].credit, + 'parent_id' :val[c].parent_id and val[c].parent_id.id, + 'level' :val[c].level, + 'label' :aa_id[1], + 'total' :aa_id[2], + } + c += 1 + accounts.append(new_acc) def missing_period(): ctx['fiscalyear'] = fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop') and \ @@ -248,10 +260,9 @@ class account_balance(report_sxw.rml_parse): 'total': True, } result_acc.append(res2) - print 'FIN: ',datetime.datetime.now() return result_acc report_sxw.report_sxw('report.account.account.balance.gene.2', 'wizard.report.account.balance.gene.2', - 'addons/l10n_co_account_financial_report/report/balance_full_2_cols.rml', + 'account_financial_report/report/balance_full_2_cols.rml', parser=account_balance, header=False) diff --git a/account_financial_report/report/account_balance_4_cols.py b/account_financial_report/report/account_balance_4_cols.py index 662c4e43..6112f58a 100644 --- a/account_financial_report/report/account_balance_4_cols.py +++ b/account_financial_report/report/account_balance_4_cols.py @@ -39,7 +39,6 @@ class account_balance(report_sxw.rml_parse): def __init__(self, cr, uid, name, context): - print 'INICIO: ',datetime.datetime.now() super(account_balance, self).__init__(cr, uid, name, context) self.sum_debit = 0.00 self.sum_credit = 0.00 @@ -117,10 +116,7 @@ class account_balance(report_sxw.rml_parse): return [] if not done: done = {} - print "Lista Form %s"%form - print "Tipo de Obj %s"%type(form) - print "form:%s"%form if form.has_key('account_list') and form['account_list']: account_ids = form['account_list'] del form['account_list'] @@ -174,26 +170,16 @@ class account_balance(report_sxw.rml_parse): ctx = self.context.copy() ctx['state'] = form.get('state','all') ctx['fiscalyear'] = fiscalyear.id - print "Fiscal year %s"%ctx['fiscalyear'] ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('special','=',False)]) - print "Periodos del Context: %s"%ctx['periods'] if form['state'] in ['byperiod', 'all']: - print "PERIODOS ANTERIORES DEBIT / CREDIT: ",ctx['periods'] ctx['periods'] = period_obj.search(self.cr, self.uid, [('id','in',form['periods'] or ctx['periods']),('special','=',False)]) - print "PERIODOS DESPUES DEBIT / CREDIT: ",ctx['periods'] - #~ ctx['periods'] = form['periods'] if form['state'] in ['bydate', 'all']: ctx['date_from'] = form['date_from'] ctx['date_to'] = form['date_to'] accounts=[] - print 'INICIANDO CALCULO DEBIT/CREDIT: ',datetime.datetime.now() val = account_obj.browse(self.cr, self.uid, [aa_id[0] for aa_id in account_ids], ctx) - print "Valor de Account_ids en get_children: %s"%account_ids - print "Valor de context %s"%ctx - #~ val = account_obj.browse(self.cr, self.uid, account_ids, ctx) - print 'INTERMEDIO CALCULO DEBIT/CREDIT: ',datetime.datetime.now() c = 0 for aa_id in account_ids: new_acc = { @@ -209,9 +195,7 @@ class account_balance(report_sxw.rml_parse): 'total' :aa_id[2], } c += 1 - print "Diccionario new_acc: %s"%new_acc accounts.append(new_acc) - print 'FINALIZANDO CALCULO DEBIT/CREDIT: ',datetime.datetime.now() def missing_period(): ctx['fiscalyear'] = fiscalyear_obj.search(self.cr, self.uid, [('date_stop','<',fiscalyear.date_start)],order='date_stop') and \ @@ -230,10 +214,8 @@ class account_balance(report_sxw.rml_parse): if form['state'] in ['byperiod', 'all']: ctx['periods'] = form['periods'] - print "PERIODOS ANTERIORES ctx['periods']: ",ctx['periods'] date_start = min([period.date_start for period in period_obj.browse(self.cr, self.uid, ctx['periods'])]) ctx['periods'] = period_obj.search(self.cr, self.uid, [('fiscalyear_id','=',fiscalyear.id),('date_stop','<=',date_start)]) - print "PERIODOS DESPUES ctx['periods']: ",ctx['periods'] if not ctx['periods']: missing_period() elif form['state'] in ['bydate']: @@ -249,8 +231,6 @@ class account_balance(report_sxw.rml_parse): for acc in account_obj.browse(self.cr, self.uid, [x[0] for x in account_ids], ctx): period_balanceinit[acc['id']] = acc.balance - print 'FINALIZANDO CALCULO INITIAL BALANCE: ',datetime.datetime.now() - # # Generate the report lines (checking each account) # @@ -329,11 +309,9 @@ class account_balance(report_sxw.rml_parse): 'total': True, } result_acc.append(res2) - print 'FIN: ',datetime.datetime.now() - print "result_acc %s"%result_acc return result_acc report_sxw.report_sxw('report.wizard.report.reporte', 'wizard.report', - 'l10n_co_account_financial_report/report/balance_full_4_cols.rml', + 'account_financial_report/report/balance_full_4_cols.rml', parser=account_balance, header=False) diff --git a/account_financial_report/report/account_report_report.xml b/account_financial_report/report/account_report_report.xml index a00c62f3..6ce7e71b 100644 --- a/account_financial_report/report/account_report_report.xml +++ b/account_financial_report/report/account_report_report.xml @@ -6,7 +6,7 @@ string="General account balance" model="account.account" name="account.account.balance.gene" - rml="l10n_co_account_financial_report/report/balance_full.rml" + rml="account_financial_report/report/balance_full.rml" header="False" auto="False" menu="False"/> @@ -15,7 +15,7 @@ string="General account balance Four Columns" model="account.account" name="account.account.balance.gene.4" - rml="l10n_co_account_financial_report/report/balance_full_4_cols.rml" + rml="account_financial_report/report/balance_full_4_cols.rml" header="False" auto="False" menu="False"/> @@ -24,7 +24,7 @@ string="General account balance Two Columns" model="account.account" name="account.account.balance.gene.2" - rml="l10n_co_account_financial_report/report/balance_full_2_cols.rml" + rml="account_financial_report/report/balance_full_2_cols.rml" header="False" auto="False" menu="False"/> diff --git a/account_financial_report/wizard/account_report_wizard.xml b/account_financial_report/wizard/account_report_wizard.xml index 8c87fa7e..7870e94d 100644 --- a/account_financial_report/wizard/account_report_wizard.xml +++ b/account_financial_report/wizard/account_report_wizard.xml @@ -15,9 +15,6 @@ - @@ -28,20 +25,6 @@ - - @@ -201,8 +184,7 @@ new - - + @@ -17,7 +17,7 @@ menu="True" model="wizard.report.account.balance.gene.2" name="account.account.balance.gene.2" - rml="l10n_co_account_financial_report/report/balance_full_2_cols.rml" + rml="account_financial_report/report/balance_full_2_cols.rml" string="Balance de Comprobacion Wizard 2 Columnas" header="False" /> @@ -27,7 +27,7 @@ menu="True" model="wizard.report.account.balance.gene" name="account.account.balance.gene" - rml="l10n_co_account_financial_report/report/balance_full.rml" + rml="account_financial_report/report/balance_full.rml" string="Balance de Comprobacion Wizard" header="False" />