Browse Source

[pep8] - review on account_export_csv, account_move_line_report_xls, account_journal_report_xls, account_financial_report_horizontal, account_financial_report_webkit_xls

pull/6/head
laetitia.gangloff@acsone.eu 10 years ago
parent
commit
8ce2b82351
  1. 2
      account_export_csv/__init__.py
  2. 2
      account_export_csv/wizard/__init__.py
  3. 1
      account_export_csv/wizard/account_export_csv.py
  4. 4
      account_financial_report_horizontal/__init__.py
  5. 4
      account_financial_report_horizontal/report/__init__.py
  6. 8
      account_financial_report_horizontal/report/account_balance_sheet.py
  7. 8
      account_financial_report_horizontal/report/account_profit_loss.py
  8. 25
      account_financial_report_horizontal/report/common_report_header.py
  9. 8
      account_financial_report_horizontal/wizard/__init__.py
  10. 2
      account_financial_report_horizontal/wizard/account_report_balance_sheet.py
  11. 4
      account_financial_report_horizontal/wizard/account_report_common.py
  12. 2
      account_financial_report_horizontal/wizard/account_report_common_account.py
  13. 2
      account_financial_report_horizontal/wizard/account_report_profit_loss.py
  14. 5
      account_financial_report_webkit_xls/__openerp__.py
  15. 2
      account_financial_report_webkit_xls/report/__init__.py
  16. 4
      account_financial_report_webkit_xls/report/general_ledger_xls.py
  17. 7
      account_financial_report_webkit_xls/report/partner_ledger_xls.py
  18. 5
      account_financial_report_webkit_xls/report/partners_balance_xls.py
  19. 2
      account_financial_report_webkit_xls/report/trial_balance_xls.py
  20. 2
      account_journal_report_xls/__init__.py
  21. 2
      account_journal_report_xls/__openerp__.py
  22. 6
      account_journal_report_xls/report/__init__.py
  23. 4
      account_journal_report_xls/report/nov_account_journal.py
  24. 12
      account_journal_report_xls/report/nov_account_journal_xls.py
  25. 2
      account_journal_report_xls/wizard/__init__.py
  26. 6
      account_journal_report_xls/wizard/print_journal_wizard.py
  27. 9
      account_move_line_report_xls/report/move_line_list_xls.py

2
account_export_csv/__init__.py

@ -19,4 +19,4 @@
# #
############################################################################## ##############################################################################
import wizard
from . import wizard

2
account_export_csv/wizard/__init__.py

@ -19,4 +19,4 @@
# #
############################################################################## ##############################################################################
import account_export_csv
from . import account_export_csv

1
account_export_csv/wizard/account_export_csv.py

@ -333,7 +333,6 @@ class AccountCSVExport(orm.TransientModel):
account_move_reconcile.name as full_reconcile, account_move_reconcile.name as full_reconcile,
account_move_line.reconcile_partial_id AS partial_reconcile_id, account_move_line.reconcile_partial_id AS partial_reconcile_id,
account_analytic_account.code AS analytic_account_code, account_analytic_account.code AS analytic_account_code,
account_move.name AS entry_number, account_move.name AS entry_number,
account_account.name AS account_name, account_account.name AS account_name,
account_move_line.debit - account_move_line.credit AS balance, account_move_line.debit - account_move_line.credit AS balance,

4
account_financial_report_horizontal/__init__.py

@ -1,2 +1,2 @@
import report
import wizard
from . import report
from . import wizard

4
account_financial_report_horizontal/report/__init__.py

@ -1,3 +1,3 @@
# import account_balance # import account_balance
import account_balance_sheet
import account_profit_loss
from . import account_balance_sheet
from . import account_profit_loss

8
account_financial_report_horizontal/report/account_balance_sheet.py

@ -24,7 +24,6 @@
import time import time
import openerp.pooler as pooler
from openerp.report import report_sxw from openerp.report import report_sxw
from openerp.addons.account_financial_report_horizontal.report import ( from openerp.addons.account_financial_report_horizontal.report import (
account_profit_loss account_profit_loss
@ -97,14 +96,13 @@ class report_balancesheet_horizontal(
def get_data(self, data): def get_data(self, data):
cr, uid = self.cr, self.uid cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname)
# Getting Profit or Loss Balance from profit and Loss report # Getting Profit or Loss Balance from profit and Loss report
self.obj_pl.get_data(data) self.obj_pl.get_data(data)
self.res_bl = self.obj_pl.final_result() self.res_bl = self.obj_pl.final_result()
account_pool = db_pool.get('account.account')
currency_pool = db_pool.get('res.currency')
account_pool = self.pool['account.account']
currency_pool = self.pool['res.currency']
types = [ types = [
'liability', 'liability',
@ -276,5 +274,3 @@ report_sxw.report_sxw(
'account_balance_sheet.rml', 'account_balance_sheet.rml',
parser=report_balancesheet_horizontal, parser=report_balancesheet_horizontal,
header='internal') header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

8
account_financial_report_horizontal/report/account_profit_loss.py

@ -22,7 +22,6 @@
############################################################################## ##############################################################################
import time import time
import openerp.pooler as pooler
from openerp.report import report_sxw from openerp.report import report_sxw
from common_report_header import common_report_header from common_report_header import common_report_header
from openerp.tools.translate import _ from openerp.tools.translate import _
@ -101,10 +100,9 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
} }
cr, uid = self.cr, self.uid cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname)
account_pool = db_pool.get('account.account')
currency_pool = db_pool.get('res.currency')
account_pool = self.pool['account.account']
currency_pool = self.pool['res.currency']
types = [ types = [
'expense', 'expense',
@ -247,5 +245,3 @@ report_sxw.report_sxw(
'addons/account_financial_report_horizontal/report/' 'addons/account_financial_report_horizontal/report/'
'account_profit_loss.rml', 'account_profit_loss.rml',
parser=report_pl_account_horizontal, header='internal') parser=report_pl_account_horizontal, header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

25
account_financial_report_horizontal/report/common_report_header.py

@ -19,7 +19,6 @@
# #
############################################################################## ##############################################################################
import openerp.pooler as pooler
from openerp.tools.translate import _ from openerp.tools.translate import _
@ -44,25 +43,25 @@ class common_report_header(object):
def get_start_period(self, data): def get_start_period(self, data):
if data.get('form', False) and data['form'].get('period_from', False): if data.get('form', False) and data['form'].get('period_from', False):
return pooler.get_pool(self.cr.dbname).get(
'account.period').browse(self.cr, self.uid, data[
'form']['period_from'][0]).name
return self.pool['account.period'].browse(
self.cr, self.uid,
data['form']['period_from'][0]).name
return '' return ''
def get_end_period(self, data): def get_end_period(self, data):
if data.get('form', False) and data['form'].get('period_to', False): if data.get('form', False) and data['form'].get('period_to', False):
return pooler.get_pool(self.cr.dbname).get(
'account.period').browse(self.cr, self.uid, data[
'form']['period_to'][0]).name
return self.pool['account.period'].browse(
self.cr, self.uid,
data['form']['period_to'][0]).name
return '' return ''
def _get_account(self, data): def _get_account(self, data):
if data.get('form', False) and data['form'].get( if data.get('form', False) and data['form'].get(
'chart_account_id', False 'chart_account_id', False
): ):
return pooler.get_pool(self.cr.dbname).get(
'account.account').browse(self.cr, self.uid, data[
'form']['chart_account_id'][0]).name
return self.pool['account.account'].browse(
self.cr, self.uid,
data['form']['chart_account_id'][0]).name
return '' return ''
def _get_sortby(self, data): def _get_sortby(self, data):
@ -80,7 +79,7 @@ class common_report_header(object):
if data.get('form', False) and data['form'].get( if data.get('form', False) and data['form'].get(
'fiscalyear_id', False 'fiscalyear_id', False
): ):
return pooler.get_pool(self.cr.dbname).get(
'account.fiscalyear').browse(self.cr, self.uid, data[
'form']['fiscalyear_id'][0]).name
return self.pool['account.fiscalyear'].browse(
self.cr, self.uid,
data['form']['fiscalyear_id'][0]).name
return '' return ''

8
account_financial_report_horizontal/wizard/__init__.py

@ -1,4 +1,4 @@
import account_report_common
import account_report_common_account
import account_report_balance_sheet
import account_report_profit_loss
from . import account_report_common
from . import account_report_common_account
from . import account_report_balance_sheet
from . import account_report_profit_loss

2
account_financial_report_horizontal/wizard/account_report_balance_sheet.py

@ -21,7 +21,7 @@
# #
############################################################################## ##############################################################################
from osv import orm, fields
from openerp.osv import orm, fields
class account_bs_report(orm.TransientModel): class account_bs_report(orm.TransientModel):

4
account_financial_report_horizontal/wizard/account_report_common.py

@ -24,8 +24,8 @@
import time import time
from lxml import etree from lxml import etree
from osv import fields, orm
from tools.translate import _
from openerp.osv import fields, orm
from openerp.tools.translate import _
class account_common_report(orm.TransientModel): class account_common_report(orm.TransientModel):

2
account_financial_report_horizontal/wizard/account_report_common_account.py

@ -21,7 +21,7 @@
# #
############################################################################## ##############################################################################
from osv import orm, fields
from openerp.osv import orm, fields
class account_common_account_report(orm.TransientModel): class account_common_account_report(orm.TransientModel):

2
account_financial_report_horizontal/wizard/account_report_profit_loss.py

@ -21,7 +21,7 @@
# #
############################################################################## ##############################################################################
from osv import orm, fields
from openerp.osv import orm, fields
class account_pl_report(orm.TransientModel): class account_pl_report(orm.TransientModel):

5
account_financial_report_webkit_xls/__openerp__.py

@ -36,9 +36,8 @@
""", """,
'depends': ['report_xls', 'account_financial_report_webkit'], 'depends': ['report_xls', 'account_financial_report_webkit'],
'demo_xml': [],
'init_xml': [],
'update_xml': [
'demo': [],
'data': [
'wizard/general_ledger_wizard_view.xml', 'wizard/general_ledger_wizard_view.xml',
'wizard/trial_balance_wizard_view.xml', 'wizard/trial_balance_wizard_view.xml',
'wizard/partners_ledger_wizard_view.xml', 'wizard/partners_ledger_wizard_view.xml',

2
account_financial_report_webkit_xls/report/__init__.py

@ -25,5 +25,3 @@ from . import trial_balance_xls
from . import partners_balance_xls from . import partners_balance_xls
from . import partner_ledger_xls from . import partner_ledger_xls
from . import open_invoices_xls from . import open_invoices_xls
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

4
account_financial_report_webkit_xls/report/general_ledger_xls.py

@ -146,7 +146,8 @@ class general_ledger_xls(report_xls):
c_hdr_cell_style = xlwt.easyxf(cell_format) c_hdr_cell_style = xlwt.easyxf(cell_format)
c_hdr_cell_style_right = xlwt.easyxf(cell_format + _xs['right']) c_hdr_cell_style_right = xlwt.easyxf(cell_format + _xs['right'])
c_hdr_cell_style_center = xlwt.easyxf(cell_format + _xs['center']) c_hdr_cell_style_center = xlwt.easyxf(cell_format + _xs['center'])
c_hdr_cell_style_decimal = xlwt.easyxf(cell_format + _xs['right'],
c_hdr_cell_style_decimal = xlwt.easyxf(
cell_format + _xs['right'],
num_format_str=report_xls.decimal_format) num_format_str=report_xls.decimal_format)
# Column Initial Balance Row # Column Initial Balance Row
@ -350,4 +351,3 @@ class general_ledger_xls(report_xls):
general_ledger_xls('report.account.account_report_general_ledger_xls', general_ledger_xls('report.account.account_report_general_ledger_xls',
'account.account', 'account.account',
parser=GeneralLedgerWebkit) parser=GeneralLedgerWebkit)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

7
account_financial_report_webkit_xls/report/partner_ledger_xls.py

@ -331,7 +331,7 @@ class partner_ledger_xls(report_xls):
debit_cell = rowcol_to_cell(row_pos, 7) debit_cell = rowcol_to_cell(row_pos, 7)
credit_cell = rowcol_to_cell(row_pos, 8) credit_cell = rowcol_to_cell(row_pos, 8)
cumbal_formula += debit_cell + '-' + credit_cell cumbal_formula += debit_cell + '-' + credit_cell
################## Print row ledger line data #########
# Print row ledger line data #
if line.get('ldate'): if line.get('ldate'):
c_specs = [ c_specs = [
@ -376,7 +376,7 @@ class partner_ledger_xls(report_xls):
ws, row_pos, row_data, ll_cell_style) ws, row_pos, row_data, ll_cell_style)
# end for line # end for line
################## Print row Cumulated Balance by partner #
# Print row Cumulated Balance by partner #
debit_partner_start = rowcol_to_cell(row_start_partner, 7) debit_partner_start = rowcol_to_cell(row_start_partner, 7)
debit_partner_end = rowcol_to_cell(row_pos - 1, 7) debit_partner_end = rowcol_to_cell(row_pos - 1, 7)
debit_partner_total = 'SUM(' + debit_partner_start + \ debit_partner_total = 'SUM(' + debit_partner_start + \
@ -427,7 +427,7 @@ class partner_ledger_xls(report_xls):
account_balance_cumul += cumul_balance account_balance_cumul += cumul_balance
account_balance_cumul_curr += cumul_balance_curr account_balance_cumul_curr += cumul_balance_curr
################## Print row Cumulated Balance by account #####
# Print row Cumulated Balance by account #
c_specs = [ c_specs = [
('acc_title', 5, 0, 'text', ' - '. ('acc_title', 5, 0, 'text', ' - '.
join([account.code, account.name])), ] join([account.code, account.name])), ]
@ -462,4 +462,3 @@ class partner_ledger_xls(report_xls):
partner_ledger_xls('report.account.account_report_partner_ledger_xls', partner_ledger_xls('report.account.account_report_partner_ledger_xls',
'account.account', 'account.account',
parser=PartnersLedgerWebkit) parser=PartnersLedgerWebkit)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

5
account_financial_report_webkit_xls/report/partners_balance_xls.py

@ -295,7 +295,8 @@ class partners_balance_xls(report_xls):
regular_cell_style_center = xlwt.easyxf( regular_cell_style_center = xlwt.easyxf(
regular_cell_format + _xs['center']) regular_cell_format + _xs['center'])
regular_cell_style_decimal = xlwt.easyxf( regular_cell_style_decimal = xlwt.easyxf(
regular_cell_format + _xs['right'], num_format_str=report_xls.decimal_format)
regular_cell_format + _xs['right'],
num_format_str=report_xls.decimal_format)
regular_cell_style_pct = xlwt.easyxf( regular_cell_style_pct = xlwt.easyxf(
regular_cell_format + _xs['center'], num_format_str='0') regular_cell_format + _xs['center'], num_format_str='0')
@ -427,5 +428,3 @@ class partners_balance_xls(report_xls):
partners_balance_xls('report.account.account_report_partner_balance_xls', partners_balance_xls('report.account.account_report_partner_balance_xls',
'account.account', 'account.account',
parser=PartnerBalanceWebkit) parser=PartnerBalanceWebkit)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

2
account_financial_report_webkit_xls/report/trial_balance_xls.py

@ -325,5 +325,3 @@ class trial_balance_xls(report_xls):
trial_balance_xls('report.account.account_report_trial_balance_xls', trial_balance_xls('report.account.account_report_trial_balance_xls',
'account.account', 'account.account',
parser=TrialBalanceWebkit) parser=TrialBalanceWebkit)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

2
account_journal_report_xls/__init__.py

@ -28,5 +28,3 @@ except ImportError:
import logging import logging
logging.getLogger('openerp.module').warning('''report_xls not available in logging.getLogger('openerp.module').warning('''report_xls not available in
addons path. account_financial_report_webkit_xls will not be usable''') addons path. account_financial_report_webkit_xls will not be usable''')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

2
account_journal_report_xls/__openerp__.py

@ -52,5 +52,3 @@ cf. https://launchpad.net/openerp-reporting-engines
'wizard/print_journal_wizard.xml', 'wizard/print_journal_wizard.xml',
], ],
} }
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

6
account_journal_report_xls/report/__init__.py

@ -20,7 +20,5 @@
# #
############################################################################## ##############################################################################
import nov_account_journal
import nov_account_journal_xls
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
from . import nov_account_journal
from . import nov_account_journal_xls

4
account_journal_report_xls/report/nov_account_journal.py

@ -261,7 +261,7 @@ class nov_journal_print(report_sxw.rml_parse):
key = (line['account_id'], key = (line['account_id'],
line['tax_code_id'], line['tax_code_id'],
line['partner_id']) line['partner_id'])
if not key in lines_grouped:
if key not in lines_grouped:
lines_grouped[key] = line lines_grouped[key] = line
else: else:
lines_grouped[key]['debit'] += line['debit'] lines_grouped[key]['debit'] += line['debit']
@ -358,5 +358,3 @@ report_sxw.report_sxw(
'report.nov.account.journal.print', 'account.journal', 'report.nov.account.journal.print', 'account.journal',
'addons/account_journal_report_xls/report/nov_account_journal.rml', 'addons/account_journal_report_xls/report/nov_account_journal.rml',
parser=nov_journal_print, header=False) parser=nov_journal_print, header=False)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

12
account_journal_report_xls/report/nov_account_journal_xls.py

@ -86,7 +86,8 @@ class account_journal_xls(report_xls):
'header': [1, 20, 'text', _render("_('Entry')")], 'header': [1, 20, 'text', _render("_('Entry')")],
'lines': 'lines':
[1, 0, 'text', [1, 0, 'text',
_render("l['move_name'] != '/' and l['move_name'] or ('*'+str(l['move_id']))")],
_render("l['move_name'] != '/' and l['move_name']\
or ('*'+str(l['move_id']))")],
'totals': [1, 0, 'text', None]}, 'totals': [1, 0, 'text', None]},
'move_date': { 'move_date': {
'header': [1, 13, 'text', _render("_('Date')")], 'header': [1, 13, 'text', _render("_('Date')")],
@ -141,7 +142,8 @@ class account_journal_xls(report_xls):
[1, 0, [1, 0,
_render("l['date_maturity'] and 'date' or 'text'"), _render("l['date_maturity'] and 'date' or 'text'"),
_render( _render(
"l['date_maturity'] and datetime.strptime(l['date_maturity'],'%Y-%m-%d') or None"),
"l['date_maturity'] and datetime.\
strptime(l['date_maturity'],'%Y-%m-%d') or None"),
None, self.aml_cell_style_date], None, self.aml_cell_style_date],
'totals': [1, 0, 'text', None]}, 'totals': [1, 0, 'text', None]},
'debit': { 'debit': {
@ -374,7 +376,9 @@ class account_journal_xls(report_xls):
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: in wanted_list:
raise orm.except_orm(_('Customisation Error!'), raise orm.except_orm(_('Customisation Error!'),
_("The 'Balance' field is a calculated XLS field requiring the presence of the 'Debit' and 'Credit' fields !"))
_("The 'Balance' field is a calculated XLS\
field requiring the presence of the\
'Debit' and 'Credit' fields !"))
for o in objects: for o in objects:
@ -399,5 +403,3 @@ class account_journal_xls(report_xls):
account_journal_xls('report.nov.account.journal.xls', 'account.journal.period', account_journal_xls('report.nov.account.journal.xls', 'account.journal.period',
parser=account_journal_xls_parser) parser=account_journal_xls_parser)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

2
account_journal_report_xls/wizard/__init__.py

@ -21,5 +21,3 @@
############################################################################## ##############################################################################
from . import print_journal_wizard from . import print_journal_wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

6
account_journal_report_xls/wizard/print_journal_wizard.py

@ -114,7 +114,9 @@ class account_print_journal_xls(orm.TransientModel):
FROM account_period ap FROM account_period ap
WHERE ap.date_start>=%s AND ap.date_stop<=%s AND company_id=%s WHERE ap.date_start>=%s AND ap.date_stop<=%s AND company_id=%s
ORDER BY date_start, special DESC""", ORDER BY date_start, special DESC""",
(period_from.date_start, period_to.date_stop, company_id))
(period_from.date_start,
period_to.date_stop,
company_id))
wiz_period_ids = map(lambda x: x[0], cr.fetchall()) wiz_period_ids = map(lambda x: x[0], cr.fetchall())
wiz_journal_ids = [j.id for j in wiz_form.journal_ids] wiz_journal_ids = [j.id for j in wiz_form.journal_ids]
@ -190,5 +192,3 @@ class account_print_journal_xls(orm.TransientModel):
'type': 'ir.actions.report.xml', 'type': 'ir.actions.report.xml',
'report_name': 'nov.account.journal.print', 'report_name': 'nov.account.journal.print',
'datas': datas} 'datas': datas}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

9
account_move_line_report_xls/report/move_line_list_xls.py

@ -136,7 +136,9 @@ class move_line_xls(report_xls):
[1, 0, [1, 0,
_render("line.date_maturity.val and 'date' or 'text'"), _render("line.date_maturity.val and 'date' or 'text'"),
_render( _render(
"line.date_maturity.val and datetime.strptime(line.date_maturity,'%Y-%m-%d') or None"),
"line.date_maturity.val\
and datetime.strptime(line.date_maturity,'%Y-%m-%d')\
or None"),
None, self.aml_cell_style_date], None, self.aml_cell_style_date],
'totals': [1, 0, 'text', None]}, 'totals': [1, 0, 'text', None]},
'debit': { 'debit': {
@ -296,7 +298,8 @@ class move_line_xls(report_xls):
if not (credit_pos and debit_pos) and 'balance' in wanted_list: if not (credit_pos and debit_pos) and 'balance' in wanted_list:
raise orm.except_orm( raise orm.except_orm(
_('Customisation Error!'), _('Customisation Error!'),
_("The 'Balance' field is a calculated XLS field requiring the presence of the 'Debit' and 'Credit' fields !"))
_("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 # report_name = objects[0]._description or objects[0]._name
report_name = _("Journal Items") report_name = _("Journal Items")
@ -364,5 +367,3 @@ class move_line_xls(report_xls):
move_line_xls('report.move.line.list.xls', move_line_xls('report.move.line.list.xls',
'account.move.line', 'account.move.line',
parser=move_line_xls_parser) parser=move_line_xls_parser)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
Loading…
Cancel
Save