Browse Source

[pep8] - account_financial_report_horizontal

pull/6/head
laetitia.gangloff@acsone.eu 11 years ago
parent
commit
b611fddb1c
  1. 2
      account_financial_report_horizontal/report/__init__.py
  2. 28
      account_financial_report_horizontal/report/account_balance_sheet.py
  3. 14
      account_financial_report_horizontal/report/account_profit_loss.py
  4. 4
      account_financial_report_horizontal/report/common_report_header.py

2
account_financial_report_horizontal/report/__init__.py

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

28
account_financial_report_horizontal/report/account_balance_sheet.py

@ -24,18 +24,19 @@
import time import time
import pooler
from report import report_sxw
import openerp.pooler as pooler
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 +70,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(
@ -81,7 +80,7 @@ class report_balancesheet_horizontal(
data['lang'] = lang_dict.get('context_lang') or False data['lang'] = lang_dict.get('context_lang') or False
return super( return super(
report_balancesheet_horizontal, self 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): def sum_dr(self):
if self.res_bl['type'] == _('Net Profit'): if self.res_bl['type'] == _('Net Profit'):
@ -100,7 +99,7 @@ class report_balancesheet_horizontal(
cr, uid = self.cr, self.uid cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname) 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()
@ -124,7 +123,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:
@ -161,13 +159,13 @@ class report_balancesheet_horizontal(
'level': account.level, 'level': account.level,
'balance': ( 'balance': (
account.balance and typ == 'liability' and -1 or 1 account.balance and typ == 'liability' and -1 or 1
) * account.balance,
) * account.balance,
'type': account.type, 'type': account.type,
} }
currency = ( currency = (
account.currency_id and account.currency_id account.currency_id and account.currency_id
or account.company_id.currency_id or account.company_id.currency_id
)
)
if typ == 'liability' and account.type != 'view' and ( if typ == 'liability' and account.type != 'view' and (
account.debit != account.credit account.debit != account.credit
): ):
@ -184,7 +182,7 @@ class report_balancesheet_horizontal(
not currency_pool.is_zero( not currency_pool.is_zero(
self.cr, self.uid, currency, account.debit self.cr, self.uid, currency, account.debit
) )
) or (
) or (
not currency_pool.is_zero( not currency_pool.is_zero(
self.cr, self.uid, currency, self.cr, self.uid, currency,
account.balance account.balance
@ -226,7 +224,7 @@ class report_balancesheet_horizontal(
'level1': cal_list['asset'][i]['level'], 'level1': cal_list['asset'][i]['level'],
'balance1': cal_list['asset'][i]['balance'], 'balance1': cal_list['asset'][i]['balance'],
'type1': cal_list['asset'][i]['type'], 'type1': cal_list['asset'][i]['type'],
}
}
self.result_temp.append(temp) self.result_temp.append(temp)
else: else:
if i < len(cal_list['asset']): if i < len(cal_list['asset']):

14
account_financial_report_horizontal/report/account_profit_loss.py

@ -22,10 +22,10 @@
############################################################################## ##############################################################################
import time import time
import pooler
from report import report_sxw
import openerp.pooler as pooler
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 +63,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(
@ -98,7 +98,7 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
'balance': account.balance and ( 'balance': account.balance and (
account_type == 'income' and -1 or 1) * account.balance, account_type == 'income' and -1 or 1) * account.balance,
'type': account.type, 'type': account.type,
}
}
cr, uid = self.cr, self.uid cr, uid = self.cr, self.uid
db_pool = pooler.get_pool(self.cr.dbname) db_pool = pooler.get_pool(self.cr.dbname)
@ -109,7 +109,7 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header):
types = [ types = [
'expense', 'expense',
'income' 'income'
]
]
ctx = self.context.copy() ctx = self.context.copy()
ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False)

4
account_financial_report_horizontal/report/common_report_header.py

@ -19,8 +19,8 @@
# #
############################################################################## ##############################################################################
import pooler
from tools.translate import _
import openerp.pooler as pooler
from openerp.tools.translate import _
class common_report_header(object): class common_report_header(object):

Loading…
Cancel
Save