Browse Source

[pep8] - account_financial_report_horizontal

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

[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/689/head
laetitia.gangloff@acsone.eu 10 years ago
committed by Nikos Tsirintanis
parent
commit
ac9b62fc21
  1. 4
      account_financial_report_horizontal/__init__.py
  2. 4
      account_financial_report_horizontal/report/__init__.py
  3. 22
      account_financial_report_horizontal/report/account_balance_sheet.py
  4. 16
      account_financial_report_horizontal/report/account_profit_loss.py
  5. 27
      account_financial_report_horizontal/report/common_report_header.py
  6. 8
      account_financial_report_horizontal/wizard/__init__.py
  7. 2
      account_financial_report_horizontal/wizard/account_report_balance_sheet.py
  8. 4
      account_financial_report_horizontal/wizard/account_report_common.py
  9. 2
      account_financial_report_horizontal/wizard/account_report_common_account.py
  10. 2
      account_financial_report_horizontal/wizard/account_report_profit_loss.py

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

22
account_financial_report_horizontal/report/account_balance_sheet.py

@ -24,18 +24,18 @@
import time import time
import pooler
from 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
) )
from common_report_header import common_report_header from common_report_header import common_report_header
from tools.translate import _
from openerp.tools.translate import _
class report_balancesheet_horizontal( class report_balancesheet_horizontal(
report_sxw.rml_parse, common_report_header report_sxw.rml_parse, common_report_header
): ):
def __init__(self, cr, uid, name, context=None): def __init__(self, cr, uid, name, context=None):
super(report_balancesheet_horizontal, self).__init__( super(report_balancesheet_horizontal, self).__init__(
cr, uid, name, context=context) cr, uid, name, context=context)
@ -69,11 +69,9 @@ class report_balancesheet_horizontal(
def set_context(self, objects, data, ids, report_type=None): def set_context(self, objects, data, ids, report_type=None):
new_ids = ids new_ids = ids
if (data['model'] == 'ir.ui.menu'): 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]] or []
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( objects = self.pool.get('account.account').browse(
self.cr, self.uid, new_ids) self.cr, self.uid, new_ids)
lang_dict = self.pool.get('res.users').read( lang_dict = self.pool.get('res.users').read(
@ -98,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',
@ -124,7 +121,6 @@ class report_balancesheet_horizontal(
ctx['date_to'] = data['form'].get('date_to', False) ctx['date_to'] = data['form'].get('date_to', False)
ctx['state'] = data['form'].get('target_move', 'all') ctx['state'] = data['form'].get('target_move', 'all')
cal_list = {} cal_list = {}
pl_dict = {}
account_dict = {} account_dict = {}
account_id = data['form'].get('chart_account_id', False) account_id = data['form'].get('chart_account_id', False)
if account_id: if account_id:
@ -278,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:

16
account_financial_report_horizontal/report/account_profit_loss.py

@ -22,10 +22,9 @@
############################################################################## ##############################################################################
import time import time
import pooler
from 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 tools.translate import _
from openerp.tools.translate import _
class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
@ -63,8 +62,8 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
new_ids = ids new_ids = ids
if (data['model'] == 'ir.ui.menu'): if (data['model'] == 'ir.ui.menu'):
new_ids = 'chart_account_id' in data['form'] and data['form'][ new_ids = 'chart_account_id' in data['form'] and data['form'][
'chart_account_id'] and [data['form'][
'chart_account_id'][0]] or []
'chart_account_id'] and [data['form']['chart_account_id'][0]] \
or []
objects = self.pool.get('account.account').browse( objects = self.pool.get('account.account').browse(
self.cr, self.uid, new_ids) self.cr, self.uid, new_ids)
lang_dict = self.pool.get('res.users').read( lang_dict = self.pool.get('res.users').read(
@ -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:

27
account_financial_report_horizontal/report/common_report_header.py

@ -19,8 +19,7 @@
# #
############################################################################## ##############################################################################
import pooler
from tools.translate import _
from openerp.tools.translate import _
class common_report_header(object): class common_report_header(object):
@ -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):

Loading…
Cancel
Save