Browse Source

[pep8] review on account_financial_report, account_financial_report_horizontal, account_financial_report_webkit_xls, account_journal_report_xls, account_move_line_report_xls

pull/6/head
laetitia.gangloff@acsone.eu 10 years ago
parent
commit
746679c598
  1. 46
      account_financial_report/model/account_financial_report.py
  2. 56
      account_financial_report/report/parser.py
  3. 34
      account_financial_report/wizard/wizard.py
  4. 4
      account_financial_report_horizontal/report/account_balance_sheet.py
  5. 2
      account_financial_report_horizontal/report/account_profit_loss.py
  6. 6
      account_financial_report_webkit_xls/report/general_ledger_xls.py
  7. 22
      account_financial_report_webkit_xls/report/open_invoices_xls.py
  8. 6
      account_financial_report_webkit_xls/report/partner_ledger_xls.py
  9. 7
      account_financial_report_webkit_xls/report/partners_balance_xls.py
  10. 5
      account_financial_report_webkit_xls/report/trial_balance_xls.py
  11. 54
      account_journal_report_xls/report/nov_account_journal.py
  12. 8
      account_journal_report_xls/report/nov_account_journal_xls.py
  13. 2
      account_journal_report_xls/wizard/print_journal_wizard.py
  14. 8
      account_move_line_report_xls/report/move_line_list_xls.py

46
account_financial_report/model/account_financial_report.py

@ -38,9 +38,10 @@ class account_financial_report(osv.osv):
'name': fields.char('Name', size=128, required=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
'currency_id': fields.many2one('res.currency', 'Currency',
help="Currency at which this report\
will be expressed. If not selected will\
be used the one set in the company"),
help="Currency at which this report \
will be expressed. If not selected \
will be used the one set in the \
company"),
'inf_type': fields.selection([('BS', 'Balance Sheet'),
('IS', 'Income Statement')],
'Type',
@ -58,7 +59,7 @@ class account_financial_report(osv.osv):
('mov', 'With movements'),
('bal_mov', 'With Balance / Movements')], 'Display accounts'),
'display_account_level': fields.integer('Up to level',
help='Display accounts up to\
help='Display accounts up to \
this level (0 to show all)'),
'account_ids': fields.many2many('account.account', 'afr_account_rel',
'afr_id', 'account_id',
@ -70,27 +71,24 @@ class account_financial_report(osv.osv):
'account.period', 'afr_period_rel', 'afr_id', 'period_id',
'Periods', help='All periods in the fiscal year if empty'),
'analytic_ledger': fields.boolean('Analytic Ledger',
help="Allows to Generate an Analytic\
Ledger for accounts with moves.\
Available when Balance Sheet and\
'Initial | Debit | Credit | YTD'\
are selected"),
'journal_ledger': fields.boolean('journal Ledger',
help="Allows to Generate an journal\
Ledger for accounts with moves.\
Available when Balance Sheet and\
'Initial | Debit | Credit | YTD'\
are selected"),
'partner_balance': fields.boolean('Partner Balance',
help="Allows to Generate a Partner\
Balance for accounts with moves.\
Available when Balance Sheet and\
'Initial | Debit | Credit | YTD'\
are selected"),
'analytic_ledger': fields.boolean(
'Analytic Ledger',
help="Allows to Generate an Analytic Ledger for accounts with \
moves. Available when Balance Sheet and 'Initial | Debit \
| Credit | YTD' are selected"),
'journal_ledger': fields.boolean(
'journal Ledger',
help="Allows to Generate an journal Ledger for accounts with \
moves. Available when Balance Sheet and 'Initial | Debit | \
Credit | YTD' are selected"),
'partner_balance': fields.boolean(
'Partner Balance',
help="Allows to Generate a Partner Balance for accounts with \
moves. Available when Balance Sheet and 'Initial | Debit | \
Credit | YTD' are selected"),
'tot_check': fields.boolean(
'Summarize?',
help='Checking will add a new line at the end of the Report which\
help='Checking will add a new line at the end of the Report which \
will Summarize Columns in Report'),
'lab_str': fields.char('Description',
help='Description for the Summary',
@ -99,7 +97,7 @@ class account_financial_report(osv.osv):
[('posted', 'All Posted Entries'),
('all', 'All Entries'), ],
'Entries to Include', required=True,
help='Print All Accounting Entries or just Posted\
help='Print All Accounting Entries or just Posted \
Accounting Entries'),
# ~ Deprecated fields

56
account_financial_report/report/parser.py

@ -101,7 +101,7 @@ class account_balance(report_sxw.rml_parse):
list, tuple) and form['afr_id'][0] or form['afr_id']
if afr_id:
name = self.pool.get('afr').browse(self.cr, self.uid, afr_id).name
elif form['analytic_ledger'] and form['columns'] == 'four'\
elif form['analytic_ledger'] and form['columns'] == 'four' \
and form['inf_type'] == 'BS':
name = _('Analytic Ledger')
elif form['inf_type'] == 'BS':
@ -116,7 +116,7 @@ class account_balance(report_sxw.rml_parse):
return day, year and month
'''
if form['filter'] in ['bydate', 'all']:
return _('From ') + self.formatLang(form['date_from'], date=True)\
return _('From ') + self.formatLang(form['date_from'], date=True) \
+ _(' to ') + self.formatLang(form['date_to'], date=True)
elif form['filter'] in ['byperiod', 'all']:
aux = []
@ -127,8 +127,8 @@ class account_balance(report_sxw.rml_parse):
aux.append(period.date_start)
aux.append(period.date_stop)
sorted(aux)
return _('From ') + self.formatLang(aux[0], date=True) + _(' to ')\
+ self.formatLang(aux[-1], date=True)
return _('From ') + self.formatLang(aux[0], date=True) + \
_(' to ') + self.formatLang(aux[-1], date=True)
def get_periods_and_date_text(self, form):
"""
@ -150,7 +150,7 @@ class account_balance(report_sxw.rml_parse):
dates_str = None
if form['filter'] in ['bydate', 'all']:
dates_str = self.formatLang(form[
'date_from'], date=True) + ' - ' +\
'date_from'], date=True) + ' - ' + \
self.formatLang(form['date_to'],
date=True) + ' '
return {'periods': periods_str, 'date': dates_str}
@ -172,8 +172,8 @@ class account_balance(report_sxw.rml_parse):
if not form['currency_id']:
self.to_currency_id = self.from_currency_id
else:
self.to_currency_id = form['currency_id']\
and type(form['currency_id']) in (list, tuple)\
self.to_currency_id = form['currency_id'] \
and type(form['currency_id']) in (list, tuple) \
and form['currency_id'][0] or form['currency_id']
return self.pool.get('res.currency').browse(self.cr, self.uid,
self.to_currency_id).name
@ -346,7 +346,7 @@ class account_balance(report_sxw.rml_parse):
inner join account_period ap
on ap.id = aml.period_id
inner join account_move am
on am.id = aml.move_id """\
on am.id = aml.move_id """ \
+ where + """ order by date, am.name"""
self.cr.execute(sql_detalle)
@ -395,7 +395,7 @@ class account_balance(report_sxw.rml_parse):
inner join account_journal aj on aj.id = aml.journal_id
inner join account_account aa on aa.id = aml.account_id
inner join account_period ap on ap.id = aml.period_id
inner join account_move am on am.id = aml.move_id """\
inner join account_move am on am.id = aml.move_id """ \
+ where + """ order by date, am.name"""
self.cr.execute(sql_detalle)
@ -428,7 +428,7 @@ class account_balance(report_sxw.rml_parse):
aa_obj = self.pool.get('account.account')
ids2 = []
for aa_brw in aa_obj.browse(cr, uid, ids, context):
if aa_brw.child_id and aa_brw.level < level\
if aa_brw.child_id and aa_brw.level < level \
and aa_brw.type != 'consolidation':
if not change_sign:
ids2.append([aa_brw.id, True, False, aa_brw])
@ -487,7 +487,7 @@ class account_balance(report_sxw.rml_parse):
fiscalyear_obj.search(self.cr, self.uid,
[('date_stop', '<',
fiscalyear.date_start)],
order='date_stop')\
order='date_stop') \
and fiscalyear_obj.search(self.cr, self.uid,
[('date_stop', '<',
fiscalyear.date_start)],
@ -550,9 +550,9 @@ class account_balance(report_sxw.rml_parse):
if not form['currency_id']:
self.to_currency_id = self.from_currency_id
else:
self.to_currency_id = form['currency_id']\
and type(form['currency_id']) in (list, tuple)\
and form['currency_id'][0]\
self.to_currency_id = form['currency_id'] \
and type(form['currency_id']) in (list, tuple) \
and form['currency_id'][0] \
or form['currency_id']
if 'account_list' in form and form['account_list']:
@ -815,7 +815,7 @@ class account_balance(report_sxw.rml_parse):
dict_not_black.get(acc_id)['balance'] += all_account.get(
child_id.id).get('balance')
if form['inf_type'] == 'BS':
dict_not_black.get(acc_id)['balanceinit'] +=\
dict_not_black.get(acc_id)['balanceinit'] += \
all_account.get(child_id.id).get('balanceinit')
all_account[acc_id] = dict_not_black[acc_id]
@ -839,7 +839,7 @@ class account_balance(report_sxw.rml_parse):
#
# Check if we need to include this level
#
if not form['display_account_level']\
if not form['display_account_level'] \
or aa_id[3].level <= form['display_account_level']:
res = {
'id': id,
@ -1058,8 +1058,8 @@ class account_balance(report_sxw.rml_parse):
elif form['display_account'] == 'bal_mov' and aa_id[3].\
parent_id:
# Include accounts with balance or movements
if abs(b) >= 0.005\
or abs(d) >= 0.005\
if abs(b) >= 0.005 \
or abs(d) >= 0.005 \
or abs(c) >= 0.005:
to_include = True
else:
@ -1067,21 +1067,21 @@ class account_balance(report_sxw.rml_parse):
to_include = True
# ~ ANALYTIC LEDGER
if to_include and form['analytic_ledger']\
and form['columns'] == 'four'\
and form['inf_type'] == 'BS'\
if to_include and form['analytic_ledger'] \
and form['columns'] == 'four' \
and form['inf_type'] == 'BS' \
and res['type'] in ('other', 'liquidity',
'receivable', 'payable'):
res['mayor'] = self._get_analytic_ledger(res, ctx=ctx_end)
elif to_include and form['journal_ledger']\
and form['columns'] == 'four'\
and form['inf_type'] == 'BS'\
elif to_include and form['journal_ledger'] \
and form['columns'] == 'four' \
and form['inf_type'] == 'BS' \
and res['type'] in ('other', 'liquidity',
'receivable', 'payable'):
res['journal'] = self._get_journal_ledger(res, ctx=ctx_end)
elif to_include and form['partner_balance']\
and form['columns'] == 'four'\
and form['inf_type'] == 'BS'\
elif to_include and form['partner_balance'] \
and form['columns'] == 'four' \
and form['inf_type'] == 'BS' \
and res['type'] in ('other', 'liquidity',
'receivable', 'payable'):
res['partner'] = self._get_partner_balance(
@ -1095,7 +1095,7 @@ class account_balance(report_sxw.rml_parse):
# Check whether we must sumarize this line in the report
# or not
#
if form['tot_check'] and (res['id'] in account_list)\
if form['tot_check'] and (res['id'] in account_list) \
and (res['id'] not in tot):
if form['columns'] == 'qtr':
tot_check = True

34
account_financial_report/wizard/wizard.py

@ -39,10 +39,10 @@ class wizard_report(osv.osv_memory):
'afr', 'Custom Report',
help='If you have already set a Custom Report, Select it Here.'),
'company_id': fields.many2one('res.company', 'Company', required=True),
'currency_id': fields.many2one('res.currency', 'Currency',
help="Currency at which this report\
will be expressed. If not selected will\
be used the one set in the company"),
'currency_id': fields.many2one(
'res.currency', 'Currency',
help="Currency at which this report will be expressed. If not \
selected will be used the one set in the company"),
'inf_type': fields.selection([('BS', 'Balance Sheet'),
('IS', 'Income Statement')],
'Type',
@ -81,22 +81,22 @@ class wizard_report(osv.osv_memory):
'analytic_ledger': fields.boolean(
'Analytic Ledger',
help="Allows to Generate an Analytic Ledger for accounts with\
moves. Available when Balance Sheet and 'Initial | Debit | Credit\
help="Allows to Generate an Analytic Ledger for accounts with \
moves. Available when Balance Sheet and 'Initial | Debit | Credit \
| YTD' are selected"),
'journal_ledger': fields.boolean(
'Journal Ledger',
help="Allows to Generate an Journal Ledger for accounts with\
moves. Available when Balance Sheet and 'Initial | Debit | Credit\
help="Allows to Generate an Journal Ledger for accounts with \
moves. Available when Balance Sheet and 'Initial | Debit | Credit \
| YTD' are selected"),
'partner_balance': fields.boolean(
'Partner Balance',
help="Allows to Generate a Partner Balance for accounts with\
moves. Available when Balance Sheet and 'Initial | Debit | Credit\
help="Allows to Generate a Partner Balance for accounts with \
moves. Available when Balance Sheet and 'Initial | Debit | Credit \
| YTD' are selected"),
'tot_check': fields.boolean('Summarize?',
help='Checking will add a new line at the\
end of the Report which will Summarize\
help='Checking will add a new line at the \
end of the Report which will Summarize \
Columns in Report'),
'lab_str': fields.char('Description',
help='Description for the Summary', size=128),
@ -106,7 +106,7 @@ class wizard_report(osv.osv_memory):
('all', 'All Entries'),
], 'Entries to Include',
required=True,
help='Print All Accounting Entries or just Posted Accounting\
help='Print All Accounting Entries or just Posted Accounting \
Entries'),
# ~ Deprecated fields
'filter': fields.selection([('bydate', 'By Date'),
@ -338,7 +338,7 @@ class wizard_report(osv.osv_memory):
cr.execute(sqlmm)
minmax = cr.dictfetchall()
if minmax:
if (data['form']['date_to'] < minmax[0]['inicio'])\
if (data['form']['date_to'] < minmax[0]['inicio']) \
or (data['form']['date_from'] > minmax[0]['fin']):
raise osv.except_osv(_('Error !'), _(
'La interseccion entre el periodo y fecha es vacio'))
@ -348,13 +348,13 @@ class wizard_report(osv.osv_memory):
if data['form']['columns'] == 'two':
name = 'afr.2cols'
if data['form']['columns'] == 'four':
if data['form']['analytic_ledger']\
if data['form']['analytic_ledger'] \
and data['form']['inf_type'] == 'BS':
name = 'afr.analytic.ledger'
elif data['form']['journal_ledger']\
elif data['form']['journal_ledger'] \
and data['form']['inf_type'] == 'BS':
name = 'afr.journal.ledger'
elif data['form']['partner_balance']\
elif data['form']['partner_balance'] \
and data['form']['inf_type'] == 'BS':
name = 'afr.partner.balance'
else:

4
account_financial_report_horizontal/report/account_balance_sheet.py

@ -69,8 +69,8 @@ class report_balancesheet_horizontal(
def set_context(self, objects, data, ids, report_type=None):
new_ids = ids
if (data['model'] == 'ir.ui.menu'):
new_ids = 'chart_account_id' in data['form']\
and data['form']['chart_account_id']\
new_ids = 'chart_account_id' in data['form'] \
and data['form']['chart_account_id'] \
and [data['form']['chart_account_id'][0]] or []
objects = self.pool.get('account.account').browse(
self.cr, self.uid, new_ids)

2
account_financial_report_horizontal/report/account_profit_loss.py

@ -62,7 +62,7 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
new_ids = ids
if (data['model'] == 'ir.ui.menu'):
new_ids = 'chart_account_id' in data['form'] and data['form'][
'chart_account_id'] and [data['form']['chart_account_id'][0]]\
'chart_account_id'] and [data['form']['chart_account_id'][0]] \
or []
objects = self.pool.get('account.account').browse(
self.cr, self.uid, new_ids)

6
account_financial_report_webkit_xls/report/general_ledger_xls.py

@ -24,7 +24,7 @@ import xlwt
from datetime import datetime
from openerp.addons.report_xls.report_xls import report_xls
from openerp.addons.report_xls.utils import rowcol_to_cell
from openerp.addons.account_financial_report_webkit.report.general_ledger\
from openerp.addons.account_financial_report_webkit.report.general_ledger \
import GeneralLedgerWebkit
from openerp.tools.translate import _
# import logging
@ -200,13 +200,13 @@ class general_ledger_xls(report_xls):
cnt = 0
for account in objects:
display_initial_balance = account.init_balance and\
display_initial_balance = account.init_balance and \
(account.init_balance.get(
'debit', 0.0) != 0.0 or account.
init_balance.get('credit', 0.0) != 0.0)
display_ledger_lines = account.ledger_lines
if _p.display_account_raw(data) == 'all' or\
if _p.display_account_raw(data) == 'all' or \
(display_ledger_lines or display_initial_balance):
# TO DO : replace cumul amounts by xls formulas
cnt += 1

22
account_financial_report_webkit_xls/report/open_invoices_xls.py

@ -24,7 +24,7 @@ import xlwt
from datetime import datetime
from openerp.addons.report_xls.report_xls import report_xls
from openerp.addons.report_xls.utils import rowcol_to_cell
from openerp.addons.account_financial_report_webkit.report.open_invoices\
from openerp.addons.account_financial_report_webkit.report.open_invoices \
import PartnersOpenInvoicesWebkit
from openerp.tools.translate import _
# import logging
@ -146,7 +146,7 @@ class open_invoices_xls(report_xls):
_xs['borders_all'] + _xs['left'] + _xs['italic'],
num_format_str=report_xls.date_format)
# -------------------------------------------------------
global style_account_title, style_account_title_right,\
global style_account_title, style_account_title_right, \
style_account_title_decimal
cell_format = _xs['xls_title'] + _xs['bold'] + \
_xs['fill'] + _xs['borders_all']
@ -160,7 +160,7 @@ class open_invoices_xls(report_xls):
cell_format = _xs['bold']
style_partner_row = xlwt.easyxf(cell_format)
# -------------------------------------------------------
global style_partner_cumul, style_partner_cumul_right,\
global style_partner_cumul, style_partner_cumul_right, \
style_partner_cumul_center, style_partner_cumul_decimal
cell_format = _xs['bold'] + _xs['fill'] + _xs['borders_all']
style_partner_cumul = xlwt.easyxf(cell_format)
@ -336,7 +336,7 @@ class open_invoices_xls(report_xls):
# ${line.get('is_from_previous_periods') and
# 'open_invoice_previous_line' or ''} ${line.get('is_clearance_line')
# and 'clearance_line' or ''}">
if line.get('is_from_previous_periods')\
if line.get('is_from_previous_periods') \
or line.get('is_clearance_line'):
style_line_default = style_default_italic
style_line_right = style_right_italic
@ -419,7 +419,7 @@ class open_invoices_xls(report_xls):
# ${line.get('is_from_previous_periods') and
# 'open_invoice_previous_line' or ''} ${line.get('is_clearance_line')
# and 'clearance_line' or ''}">
if line.get('is_from_previous_periods') or\
if line.get('is_from_previous_periods') or \
line.get('is_clearance_line'):
style_line_default = style_default_italic
style_line_right = style_right_italic
@ -633,10 +633,10 @@ class open_invoices_xls(report_xls):
range_credit_stop = rowcol_to_cell(row_position - 1, start_col + 4)
search_key = _('Cumulated Balance on Partner')
total_debit_account = 'SUMIF(' + reference_start + ':' +\
total_debit_account = 'SUMIF(' + reference_start + ':' + \
reference_stop + ';"' + search_key + '";' + range_debit_start + \
':' + range_debit_stop + ')'
total_credit_account = 'SUMIF(' + reference_start + ':' +\
total_credit_account = 'SUMIF(' + reference_start + ':' + \
reference_stop + ';"' + search_key + '";' + range_credit_start + \
':' + range_credit_stop + ')'
@ -646,7 +646,7 @@ class open_invoices_xls(report_xls):
bal_curr_start = rowcol_to_cell(row_start_account, start_col + 6)
bal_curr_end = rowcol_to_cell(row_position - 1, start_col + 6)
cumul_balance_curr = 'SUMIF(' + reference_start + ':' +\
cumul_balance_curr = 'SUMIF(' + reference_start + ':' + \
reference_stop + ';"' + search_key + '";' + \
bal_curr_start + ':' + bal_curr_end + ')'
@ -707,10 +707,10 @@ class open_invoices_xls(report_xls):
range_credit_stop = rowcol_to_cell(row_position - 1, start_col + 4)
search_key = _('Cumulated Balance on Partner')
total_debit_account = 'SUMIF(' + reference_start + ':' +\
total_debit_account = 'SUMIF(' + reference_start + ':' + \
reference_stop + ';"' + search_key + '";' + range_debit_start + \
':' + range_debit_stop + ')'
total_credit_account = 'SUMIF(' + reference_start + ':' +\
total_credit_account = 'SUMIF(' + reference_start + ':' + \
reference_stop + ';"' + search_key + '";' + range_credit_start + \
':' + range_credit_stop + ')'
@ -720,7 +720,7 @@ class open_invoices_xls(report_xls):
bal_curr_start = rowcol_to_cell(row_start_account, start_col + 6)
bal_curr_end = rowcol_to_cell(row_position - 1, start_col + 6)
cumul_balance_curr = 'SUMIF(' + reference_start + ':' +\
cumul_balance_curr = 'SUMIF(' + reference_start + ':' + \
reference_stop + ';"' + search_key + '";' + \
bal_curr_start + ':' + bal_curr_end + ')'

6
account_financial_report_webkit_xls/report/partner_ledger_xls.py

@ -24,7 +24,7 @@ import xlwt
from datetime import datetime
from openerp.addons.report_xls.report_xls import report_xls
from openerp.addons.report_xls.utils import rowcol_to_cell
from openerp.addons.account_financial_report_webkit.report.partners_ledger\
from openerp.addons.account_financial_report_webkit.report.partners_ledger \
import PartnersLedgerWebkit
from openerp.tools.translate import _
# import logging
@ -240,7 +240,7 @@ class partner_ledger_xls(report_xls):
row_pos += 1
row_start_account = row_pos
for partner_name, p_id, p_ref, p_name in\
for partner_name, p_id, p_ref, p_name in \
account.partners_order:
total_debit = 0.0
@ -267,7 +267,7 @@ class partner_ledger_xls(report_xls):
p_id, {}).get('credit') or 0.0
init_line = False
if _p.initial_balance_mode and\
if _p.initial_balance_mode and \
(total_debit or total_credit):
init_line = True

7
account_financial_report_webkit_xls/report/partners_balance_xls.py

@ -23,7 +23,7 @@
import xlwt
from openerp.addons.report_xls.report_xls import report_xls
from openerp.addons.report_xls.utils import rowcol_to_cell
from openerp.addons.account_financial_report_webkit.report.partner_balance\
from openerp.addons.account_financial_report_webkit.report.partner_balance \
import PartnerBalanceWebkit
from openerp.tools.translate import _
# import logging
@ -186,7 +186,8 @@ class partners_balance_xls(report_xls):
_p.fiscalyear.name, None, cell_style_right)]
if _p.comparison_mode in ('single', 'multiple'):
for index in range(_p.nb_comparison):
if _p.comp_params[index]['comparison_filter'] == 'filter_year'\
if _p.comp_params[index][
'comparison_filter'] == 'filter_year' \
and _p.comp_params[index].get('fiscalyear', False):
c_specs += [('balance_%s' % index, 1, 0, 'text',
_('Balance %s') %
@ -336,7 +337,7 @@ class partners_balance_xls(report_xls):
# Name-Code/ref-Balance Year-Balance Year2-Balance C2-Balance C3"
row_pos = self.print_account_header(ws, _p, _xs, xlwt, row_pos)
for (partner_code_name, partner_id, partner_ref, partner_name)\
for (partner_code_name, partner_id, partner_ref, partner_name) \
in partners_order:
partner = current_partner_amounts.get(partner_id, {})
# in single mode, we have to display all the partners even if

5
account_financial_report_webkit_xls/report/trial_balance_xls.py

@ -23,7 +23,7 @@
import xlwt
from openerp.addons.report_xls.report_xls import report_xls
from openerp.addons.report_xls.utils import rowcol_to_cell
from openerp.addons.account_financial_report_webkit.report.trial_balance\
from openerp.addons.account_financial_report_webkit.report.trial_balance \
import TrialBalanceWebkit
from openerp.tools.translate import _
# import logging
@ -190,7 +190,8 @@ class trial_balance_xls(report_xls):
_p.fiscalyear.name, None, cell_style_right)]
if _p.comparison_mode in ('single', 'multiple'):
for index in range(_p.nb_comparison):
if _p.comp_params[index]['comparison_filter'] == 'filter_year'\
if _p.comp_params[index][
'comparison_filter'] == 'filter_year' \
and _p.comp_params[index].get('fiscalyear', False):
c_specs += [('balance_%s' % index, 1, 0, 'text',
_('Balance %s') %

54
account_journal_report_xls/report/nov_account_journal.py

@ -85,7 +85,7 @@ class nov_journal_print(report_sxw.rml_parse):
def _(self, src):
lang = self.context.get('lang', 'en_US')
return translate(self.cr, _ir_translation_name, 'report', lang, src)\
return translate(self.cr, _ir_translation_name, 'report', lang, src) \
or src
def _title(self, object):
@ -93,7 +93,7 @@ class nov_journal_print(report_sxw.rml_parse):
self._('Fiscal Year')) + ' ' + object[1].name, object[0].name)
def _amount_title(self):
return self.display_currency and\
return self.display_currency and \
(self._('Amount'), self._('Currency')) or (
self._('Debit'), self._('Credit'))
@ -140,58 +140,58 @@ class nov_journal_print(report_sxw.rml_parse):
# If performance is no issue, you can adapt the _report_xls_template in
# an inherited module to add field value translations.
self.cr.execute("SELECT l.move_id AS move_id, l.id AS aml_id, "
"am.name AS move_name,"
"coalesce(am.ref,'') AS move_ref,"
"am.name AS move_name, "
"coalesce(am.ref,'') AS move_ref, "
"am.date AS move_date, "
"aa.id AS account_id, aa.code AS acc_code,"
"aa.id AS account_id, aa.code AS acc_code, "
"aa.name AS acc_name, "
"aj.name AS journal, aj.code AS journal_code, "
"coalesce(rp.name,'') AS partner_name,"
"coalesce(rp.ref,'') AS partner_ref,"
"coalesce(rp.name,'') AS partner_name, "
"coalesce(rp.ref,'') AS partner_ref, "
"rp.id AS partner_id, "
"coalesce(l.name,'') AS aml_name, "
"l.date_maturity AS date_maturity, "
"coalesce(ap.code, ap.name) AS period, "
"coalesce(atc.code,'') AS tax_code,"
"atc.id AS tax_code_id,"
"coalesce(atc.code,'') AS tax_code, "
"atc.id AS tax_code_id, "
"coalesce(l.tax_amount,0.0) AS tax_amount, "
"coalesce(l.debit,0.0) AS debit,"
"coalesce(l.debit,0.0) AS debit, "
"coalesce(l.credit,0.0) AS credit, "
"coalesce(amr.name,'') AS reconcile,"
"coalesce(amr.name,'') AS reconcile, "
"coalesce(amrp.name,'') AS reconcile_partial, "
"ana.name AS an_acc_name,"
"ana.name AS an_acc_name, "
"coalesce(ana.code,'') AS an_acc_code, "
"coalesce(l.amount_currency,0.0) AS amount_currency, "
"rc.id AS currency_id, rc.name AS currency_name,"
"rc.id AS currency_id, rc.name AS currency_name, "
"rc.symbol AS currency_symbol, "
"coalesce(ai.internal_number,'-') AS inv_number,"
"coalesce(abs.name,'-') AS st_number,"
"coalesce(ai.internal_number,'-') AS inv_number, "
"coalesce(abs.name,'-') AS st_number, "
"coalesce(av.number,'-') AS voucher_number "
+ select_extra +
"FROM account_move_line l "
"INNER JOIN account_move am ON l.move_id = am.id "
"INNER JOIN account_account aa"
"INNER JOIN account_account aa "
"ON l.account_id = aa.id "
"INNER JOIN account_journal aj"
"INNER JOIN account_journal aj "
"ON l.journal_id = aj.id "
"INNER JOIN account_period ap ON l.period_id = ap.id "
"LEFT OUTER JOIN account_invoice ai"
"LEFT OUTER JOIN account_invoice ai "
"ON ai.move_id = am.id "
"LEFT OUTER JOIN account_voucher av"
"LEFT OUTER JOIN account_voucher av "
"ON av.move_id = am.id "
"LEFT OUTER JOIN account_bank_statement abs"
"LEFT OUTER JOIN account_bank_statement abs "
"ON l.statement_id = abs.id "
"LEFT OUTER JOIN res_partner rp"
"LEFT OUTER JOIN res_partner rp "
"ON l.partner_id = rp.id "
"LEFT OUTER JOIN account_tax_code atc"
"LEFT OUTER JOIN account_tax_code atc "
"ON l.tax_code_id = atc.id "
"LEFT OUTER JOIN account_move_reconcile amr"
"LEFT OUTER JOIN account_move_reconcile amr "
"ON l.reconcile_id = amr.id "
"LEFT OUTER JOIN account_move_reconcile amrp"
"LEFT OUTER JOIN account_move_reconcile amrp "
"ON l.reconcile_partial_id = amrp.id "
"LEFT OUTER JOIN account_analytic_account ana"
"LEFT OUTER JOIN account_analytic_account ana "
"ON l.analytic_account_id = ana.id "
"LEFT OUTER JOIN res_currency rc"
"LEFT OUTER JOIN res_currency rc "
"ON l.currency_id = rc.id "
+ join_extra +
"WHERE l.period_id IN %s AND l.journal_id = %s "
@ -300,7 +300,7 @@ class nov_journal_print(report_sxw.rml_parse):
self.cr.execute(
"SELECT distinct tax_code_id FROM account_move_line l "
"INNER JOIN account_move am ON l.move_id = am.id "
"WHERE l.period_id in %s AND l.journal_id=%s"
"WHERE l.period_id in %s AND l.journal_id=%s "
"AND l.tax_code_id IS NOT NULL AND am.state IN %s",
(tuple(period_ids), journal_id, tuple(self.move_states)))
ids = map(lambda x: x[0], self.cr.fetchall())

8
account_journal_report_xls/report/nov_account_journal_xls.py

@ -86,7 +86,7 @@ class account_journal_xls(report_xls):
'header': [1, 20, 'text', _render("_('Entry')")],
'lines':
[1, 0, 'text',
_render("l['move_name'] != '/' and l['move_name']\
_render("l['move_name'] != '/' and l['move_name'] \
or ('*'+str(l['move_id']))")],
'totals': [1, 0, 'text', None]},
'move_date': {
@ -373,11 +373,11 @@ class account_journal_xls(report_xls):
self.debit_pos = 'debit' in wanted_list and wanted_list.index('debit')
self.credit_pos = 'credit' in wanted_list and wanted_list.index(
'credit')
if not (self.credit_pos and self.debit_pos) and 'balance'\
if not (self.credit_pos and self.debit_pos) and 'balance' \
in wanted_list:
raise orm.except_orm(_('Customisation Error!'),
_("The 'Balance' field is a calculated XLS\
field requiring the presence of the\
_("The 'Balance' field is a calculated XLS \
field requiring the presence of the \
'Debit' and 'Credit' fields !"))
for o in objects:

2
account_journal_report_xls/wizard/print_journal_wizard.py

@ -22,7 +22,7 @@
from openerp.tools.translate import _
from openerp.osv import orm, fields
from openerp.addons.account.wizard.account_report_common_journal\
from openerp.addons.account.wizard.account_report_common_journal \
import account_common_journal_report
import logging
_logger = logging.getLogger(__name__)

8
account_move_line_report_xls/report/move_line_list_xls.py

@ -51,7 +51,7 @@ class move_line_xls_parser(report_sxw.rml_parse):
def _(self, src):
lang = self.context.get('lang', 'en_US')
return translate(self.cr, _ir_translation_name, 'report', lang, src)\
return translate(self.cr, _ir_translation_name, 'report', lang, src) \
or src
@ -136,8 +136,8 @@ class move_line_xls(report_xls):
[1, 0,
_render("line.date_maturity.val and 'date' or 'text'"),
_render(
"line.date_maturity.val\
and datetime.strptime(line.date_maturity,'%Y-%m-%d')\
"line.date_maturity.val \
and datetime.strptime(line.date_maturity,'%Y-%m-%d') \
or None"),
None, self.aml_cell_style_date],
'totals': [1, 0, 'text', None]},
@ -298,7 +298,7 @@ class move_line_xls(report_xls):
if not (credit_pos and debit_pos) and 'balance' in wanted_list:
raise orm.except_orm(
_('Customisation Error!'),
_("The 'Balance' field is a calculated XLS field requiring\
_("The 'Balance' field is a calculated XLS field requiring \
the presence of the 'Debit' and 'Credit' fields !"))
# report_name = objects[0]._description or objects[0]._name

Loading…
Cancel
Save