From c280549c9fd468bb9f66a4233fa558b8a5bd86aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20M=C3=A1rquez?= Date: Fri, 16 May 2014 10:06:46 -0530 Subject: [PATCH] [FIX] Fixing Backporting Issues --- .../model/account_financial_report.py | 4 +- account_financial_report/model/res_company.py | 2 +- .../report/balance_full.rml | 48 +++++----- .../report/balance_full_13_cols.rml | 30 +++--- .../report/balance_full_2_cols.rml | 26 ++--- .../report/balance_full_4_cols.rml | 24 ++--- .../balance_full_4_cols_analytic_ledger.rml | 78 +++++++-------- .../balance_full_4_cols_journal_ledger.rml | 96 +++++++++---------- .../balance_full_4_cols_partner_balance.rml | 78 +++++++-------- .../report/balance_full_5_cols.rml | 24 ++--- .../report/balance_full_qtr_cols.rml | 24 ++--- account_financial_report/report/parser.py | 49 +++++----- .../view/account_financial_report_view.xml | 48 ++++++---- account_financial_report/view/wizard.xml | 89 +++++++++-------- account_financial_report/wizard/wizard.py | 3 + 15 files changed, 319 insertions(+), 304 deletions(-) diff --git a/account_financial_report/model/account_financial_report.py b/account_financial_report/model/account_financial_report.py index fd848349..80638659 100644 --- a/account_financial_report/model/account_financial_report.py +++ b/account_financial_report/model/account_financial_report.py @@ -27,7 +27,7 @@ ############################################################################## from osv import osv, fields -import pooler +#~ import pooler import time from tools.translate import _ @@ -73,7 +73,7 @@ class account_financial_report(osv.osv): ('all', 'All Entries'), ], 'Entries to Include', required=True, help='Print All Accounting Entries or just Posted Accounting Entries'), - + 'narration': fields.text('Notes'), #~ Deprecated fields 'filter': fields.selection([('bydate', 'By Date'), ('byperiod', 'By Period'), ('all', 'By Date and Period'), ('none', 'No Filter')], 'Date/Period Filter'), diff --git a/account_financial_report/model/res_company.py b/account_financial_report/model/res_company.py index d6afd580..e5cb86c7 100755 --- a/account_financial_report/model/res_company.py +++ b/account_financial_report/model/res_company.py @@ -25,7 +25,7 @@ from osv import osv from osv import fields -from tools.translate import _ +#~ from tools.translate import _ class res_company(osv.osv): diff --git a/account_financial_report/report/balance_full.rml b/account_financial_report/report/balance_full.rml index f828965e..62630f11 100644 --- a/account_financial_report/report/balance_full.rml +++ b/account_financial_report/report/balance_full.rml @@ -5,12 +5,12 @@ - + [[company.logo and company.logo or removeParentNode('image')]] - + @@ -29,7 +29,7 @@ - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -45,7 +45,7 @@ - + @@ -62,34 +62,34 @@ - - - - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] diff --git a/account_financial_report/report/balance_full_13_cols.rml b/account_financial_report/report/balance_full_13_cols.rml index 9387a393..29eeaa26 100644 --- a/account_financial_report/report/balance_full_13_cols.rml +++ b/account_financial_report/report/balance_full_13_cols.rml @@ -8,10 +8,10 @@ [[company.logo and company.logo or removeParentNode('image')]] - + @@ -34,7 +34,7 @@ - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -42,7 +42,7 @@ - + @@ -64,20 +64,20 @@ - - @@ -87,7 +87,7 @@ - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] diff --git a/account_financial_report/report/balance_full_2_cols.rml b/account_financial_report/report/balance_full_2_cols.rml index 7e9e4f15..0c6d04ca 100644 --- a/account_financial_report/report/balance_full_2_cols.rml +++ b/account_financial_report/report/balance_full_2_cols.rml @@ -5,12 +5,12 @@ - + [[company.logo and company.logo or removeParentNode('image')]] - + @@ -33,7 +33,7 @@ - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -41,7 +41,7 @@ - + @@ -65,13 +65,13 @@ - @@ -81,7 +81,7 @@ - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] diff --git a/account_financial_report/report/balance_full_4_cols.rml b/account_financial_report/report/balance_full_4_cols.rml index c96674f0..5cdf394c 100644 --- a/account_financial_report/report/balance_full_4_cols.rml +++ b/account_financial_report/report/balance_full_4_cols.rml @@ -8,10 +8,10 @@ [[company.logo and company.logo or removeParentNode('image')]] - + @@ -34,7 +34,7 @@ - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -42,7 +42,7 @@ - + @@ -66,13 +66,13 @@ - @@ -82,7 +82,7 @@ - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] diff --git a/account_financial_report/report/balance_full_4_cols_analytic_ledger.rml b/account_financial_report/report/balance_full_4_cols_analytic_ledger.rml index 0576ccb6..d42c3b3a 100644 --- a/account_financial_report/report/balance_full_4_cols_analytic_ledger.rml +++ b/account_financial_report/report/balance_full_4_cols_analytic_ledger.rml @@ -8,10 +8,10 @@ [[company.logo and company.logo or removeParentNode('image')]] - + @@ -34,7 +34,7 @@ - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -49,7 +49,7 @@ - + @@ -73,53 +73,53 @@ - - - - - - - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] @@ -184,8 +184,8 @@ - - + +
[[ repeatIn([x for x in lines(data['form']) if x['type'] != 'view'], 'a') ]] diff --git a/account_financial_report/report/balance_full_4_cols_journal_ledger.rml b/account_financial_report/report/balance_full_4_cols_journal_ledger.rml index 749798ac..233194fe 100644 --- a/account_financial_report/report/balance_full_4_cols_journal_ledger.rml +++ b/account_financial_report/report/balance_full_4_cols_journal_ledger.rml @@ -8,10 +8,10 @@ [[company.logo and company.logo or removeParentNode('image')]] - + @@ -33,8 +33,8 @@ [[data['form'] and get_month(data['form']) or '']] - - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -56,7 +56,7 @@ - + @@ -80,67 +80,67 @@ - - - - - - - - - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] diff --git a/account_financial_report/report/balance_full_4_cols_partner_balance.rml b/account_financial_report/report/balance_full_4_cols_partner_balance.rml index 6e1c783f..34199491 100644 --- a/account_financial_report/report/balance_full_4_cols_partner_balance.rml +++ b/account_financial_report/report/balance_full_4_cols_partner_balance.rml @@ -8,10 +8,10 @@ [[company.logo and company.logo or removeParentNode('image')]] - + @@ -34,7 +34,7 @@ - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -49,7 +49,7 @@ - + @@ -73,53 +73,53 @@ - - - - - - - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] @@ -178,8 +178,8 @@ - - + +
[[ repeatIn([x for x in lines(data['form']) if x['type'] != 'view'], 'a') ]] diff --git a/account_financial_report/report/balance_full_5_cols.rml b/account_financial_report/report/balance_full_5_cols.rml index 4c54f9de..12a480af 100644 --- a/account_financial_report/report/balance_full_5_cols.rml +++ b/account_financial_report/report/balance_full_5_cols.rml @@ -8,10 +8,10 @@ [[company.logo and company.logo or removeParentNode('image')]] - + @@ -34,7 +34,7 @@ - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -42,7 +42,7 @@ - + @@ -66,13 +66,13 @@ - @@ -82,7 +82,7 @@ - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] diff --git a/account_financial_report/report/balance_full_qtr_cols.rml b/account_financial_report/report/balance_full_qtr_cols.rml index 4fb1f8c6..74013762 100644 --- a/account_financial_report/report/balance_full_qtr_cols.rml +++ b/account_financial_report/report/balance_full_qtr_cols.rml @@ -8,10 +8,10 @@ [[company.logo and company.logo or removeParentNode('image')]] - + @@ -34,7 +34,7 @@ - Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - + Printing Date: [[ formatLang(time.strftime('%Y-%m-%d %H:%M:%S'),date_time=True) ]] [[ get_informe_text(data['form']) ]] / Pág.: - @@ -42,7 +42,7 @@ - + @@ -66,13 +66,13 @@ - @@ -82,7 +82,7 @@ - [[setLang(user.lang)]] + [[setLang(user.context_lang)]] diff --git a/account_financial_report/report/parser.py b/account_financial_report/report/parser.py index 7e67c6cc..83e2fbd2 100644 --- a/account_financial_report/report/parser.py +++ b/account_financial_report/report/parser.py @@ -26,16 +26,16 @@ # along with this program. If not, see . ############################################################################## -import xml -import copy -from operator import itemgetter +#~ import xml +#~ import copy +#~ from operator import itemgetter import time -import datetime +#~ import datetime from report import report_sxw -from tools import config +#~ from tools import config from tools.translate import _ from osv import osv -from openerp.tools.safe_eval import safe_eval as eval +#~ from openerp.tools.safe_eval import safe_eval as eval class account_balance(report_sxw.rml_parse): @@ -118,11 +118,11 @@ class account_balance(report_sxw.rml_parse): return day, year and month ''' if form['filter'] in ['bydate', 'all']: - months = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", - "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"] - mes = months[time.strptime(form['date_to'], "%Y-%m-%d")[1] - 1] - ano = time.strptime(form['date_to'], "%Y-%m-%d")[0] - dia = time.strptime(form['date_to'], "%Y-%m-%d")[2] + #~ months = ["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", + #~ "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"] + #~ mes = months[time.strptime(form['date_to'], "%Y-%m-%d")[1] - 1] + #~ ano = time.strptime(form['date_to'], "%Y-%m-%d")[0] + #~ dia = time.strptime(form['date_to'], "%Y-%m-%d")[2] return _('From ') + self.formatLang(form['date_from'], date=True) + _(' to ') + self.formatLang(form['date_to'], date=True) elif form['filter'] in ['byperiod', 'all']: aux = [] @@ -138,10 +138,11 @@ class account_balance(report_sxw.rml_parse): """ Returns the text with the periods/dates used on the report. """ + form = form or {} period_obj = self.pool.get('account.period') + fiscalyear_obj = self.pool.get('account.fiscalyear') periods_str = None - fiscalyear_id = form[ - 'fiscalyear'] or fiscalyear_obj.find(self.cr, self.uid) + 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['filter'] in ['byperiod', 'all']: @@ -191,12 +192,12 @@ class account_balance(report_sxw.rml_parse): return [brw.id for brw in rc_obj.browse(self.cr, self.uid, company_id).debit_account_ids] def _get_partner_balance(self, account, init_period, ctx=None): - rp_obj = self.pool.get('res.partner') + #~ rp_obj = self.pool.get('res.partner') res = [] ctx = ctx or {} if account['type'] in ('other', 'liquidity', 'receivable', 'payable'): sql_query = """ - SELECT + SELECT CASE WHEN aml.partner_id IS NOT NULL THEN (SELECT name FROM res_partner WHERE aml.partner_id = id) @@ -213,7 +214,7 @@ class account_balance(report_sxw.rml_parse): %s FROM account_move_line AS aml INNER JOIN account_account aa ON aa.id = aml.account_id - INNER JOIN account_move am ON am.id = aml.move_id + INNER JOIN account_move am ON am.id = aml.move_id %s GROUP BY p_idx, partner_name """ @@ -226,8 +227,8 @@ class account_balance(report_sxw.rml_parse): init_periods = ', '.join([str(i) for i in init_period]) WHERE = """ - WHERE aml.period_id IN (%s) - AND aa.id = %s + WHERE aml.period_id IN (%s) + AND aa.id = %s AND aml.state <> 'draft' """ % (init_periods, account['id']) query_init = sql_query % ('SUM(aml.debit) AS init_dr', @@ -237,8 +238,8 @@ class account_balance(report_sxw.rml_parse): WHERE + WHERE_POSTED) WHERE = """ - WHERE aml.period_id IN (%s) - AND aa.id = %s + WHERE aml.period_id IN (%s) + AND aa.id = %s AND aml.state <> 'draft' """ % (cur_periods, account['id']) @@ -250,8 +251,8 @@ class account_balance(report_sxw.rml_parse): query = ''' SELECT - partner_name, - p_idx, + partner_name, + p_idx, SUM(init_dr)-SUM(init_cr) AS balanceinit, SUM(bal_dr) AS debit, SUM(bal_cr) AS credit, @@ -350,11 +351,11 @@ class account_balance(report_sxw.rml_parse): periods, account['id']) if ctx.get('state', 'posted') == 'posted': where += "AND am.state = 'posted'" - sql_detalle = """SELECT + sql_detalle = """SELECT DISTINCT am.id as am_id, aj.name as diario, am.name as name, - am.date as date, + am.date as date, ap.name as periodo from account_move_line aml inner join account_journal aj on aj.id = aml.journal_id diff --git a/account_financial_report/view/account_financial_report_view.xml b/account_financial_report/view/account_financial_report_view.xml index 99b13214..9f352dd7 100644 --- a/account_financial_report/view/account_financial_report_view.xml +++ b/account_financial_report/view/account_financial_report_view.xml @@ -6,40 +6,46 @@ afr form -
-

- - + + + + + + + + - - - - - + - - + @@ -51,8 +57,8 @@ - @@ -63,10 +69,10 @@ - + - + @@ -105,14 +111,14 @@ tree,form Create your own Customized Account Financial Reports, in here, you will be able to create Templates for generating Two types of Reports: Balance Sheets and Income Statements, incluiding Analytic Ledgers. Besides, you can select within a set of choices to get better detailed report, be it that you ask it by one or several periods, by months (12 Months + YTD), or by quarters (4QRT's + YTD). Even you can get your reports in currencies other than the one set on your company. - - - + diff --git a/account_financial_report/view/wizard.xml b/account_financial_report/view/wizard.xml index 31754940..23ce9dd1 100644 --- a/account_financial_report/view/wizard.xml +++ b/account_financial_report/view/wizard.xml @@ -7,49 +7,40 @@ wizard.report form - -
-
-

- - + + + + + + + - - - - - - + @@ -60,7 +51,7 @@ - + @@ -72,9 +63,9 @@ - @@ -85,11 +76,11 @@ - + - + @@ -97,6 +88,20 @@ + +