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/605/head
laetitia.gangloff@acsone.eu 10 years ago
committed by mreficent
parent
commit
7598eb3590
  1. 4
      account_financial_report_horizontal/__init__.py
  2. 6
      account_financial_report_horizontal/report/__init__.py
  3. 34
      account_financial_report_horizontal/report/account_balance_sheet.py
  4. 20
      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

6
account_financial_report_horizontal/report/__init__.py

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

34
account_financial_report_horizontal/report/account_balance_sheet.py

@ -24,18 +24,18 @@
import time
import pooler
from report import report_sxw
from openerp.report import report_sxw
from openerp.addons.account_financial_report_horizontal.report import (
account_profit_loss
)
from common_report_header import common_report_header
from tools.translate import _
from openerp.tools.translate import _
class report_balancesheet_horizontal(
report_sxw.rml_parse, common_report_header
):
def __init__(self, cr, uid, name, context=None):
super(report_balancesheet_horizontal, self).__init__(
cr, uid, name, context=context)
@ -69,11 +69,9 @@ 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'] 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(
self.cr, self.uid, new_ids)
lang_dict = self.pool.get('res.users').read(
@ -81,7 +79,7 @@ class report_balancesheet_horizontal(
data['lang'] = lang_dict.get('context_lang') or False
return super(
report_balancesheet_horizontal, self
).set_context(objects, data, new_ids, report_type=report_type)
).set_context(objects, data, new_ids, report_type=report_type)
def sum_dr(self):
if self.res_bl['type'] == _('Net Profit'):
@ -98,14 +96,13 @@ class report_balancesheet_horizontal(
def get_data(self, data):
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.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 = [
'liability',
@ -124,7 +121,6 @@ class report_balancesheet_horizontal(
ctx['date_to'] = data['form'].get('date_to', False)
ctx['state'] = data['form'].get('target_move', 'all')
cal_list = {}
pl_dict = {}
account_dict = {}
account_id = data['form'].get('chart_account_id', False)
if account_id:
@ -161,13 +157,13 @@ class report_balancesheet_horizontal(
'level': account.level,
'balance': (
account.balance and typ == 'liability' and -1 or 1
) * account.balance,
) * account.balance,
'type': account.type,
}
currency = (
account.currency_id and account.currency_id
or account.company_id.currency_id
)
)
if typ == 'liability' and account.type != 'view' and (
account.debit != account.credit
):
@ -184,7 +180,7 @@ class report_balancesheet_horizontal(
not currency_pool.is_zero(
self.cr, self.uid, currency, account.debit
)
) or (
) or (
not currency_pool.is_zero(
self.cr, self.uid, currency,
account.balance
@ -226,7 +222,7 @@ class report_balancesheet_horizontal(
'level1': cal_list['asset'][i]['level'],
'balance1': cal_list['asset'][i]['balance'],
'type1': cal_list['asset'][i]['type'],
}
}
self.result_temp.append(temp)
else:
if i < len(cal_list['asset']):
@ -278,5 +274,3 @@ report_sxw.report_sxw(
'account_balance_sheet.rml',
parser=report_balancesheet_horizontal,
header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

20
account_financial_report_horizontal/report/account_profit_loss.py

@ -22,10 +22,9 @@
##############################################################################
import time
import pooler
from report import report_sxw
from openerp.report import report_sxw
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):
@ -63,8 +62,8 @@ 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]] or []
'chart_account_id'] and [data['form']['chart_account_id'][0]] \
or []
objects = self.pool.get('account.account').browse(
self.cr, self.uid, new_ids)
lang_dict = self.pool.get('res.users').read(
@ -98,18 +97,17 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
'balance': account.balance and (
account_type == 'income' and -1 or 1) * account.balance,
'type': account.type,
}
}
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 = [
'expense',
'income'
]
]
ctx = self.context.copy()
ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)
@ -247,5 +245,3 @@ report_sxw.report_sxw(
'addons/account_financial_report_horizontal/report/'
'account_profit_loss.rml',
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):
@ -44,25 +43,25 @@ class common_report_header(object):
def get_start_period(self, data):
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 ''
def get_end_period(self, data):
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 ''
def _get_account(self, data):
if data.get('form', False) and data['form'].get(
'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 ''
def _get_sortby(self, data):
@ -80,7 +79,7 @@ class common_report_header(object):
if data.get('form', False) and data['form'].get(
'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 ''

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):

4
account_financial_report_horizontal/wizard/account_report_common.py

@ -24,8 +24,8 @@
import time
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):

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):

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):

Loading…
Cancel
Save