From b611fddb1cd0a14cec1ee7265b7f531f7fdfe5e7 Mon Sep 17 00:00:00 2001 From: "laetitia.gangloff@acsone.eu" Date: Thu, 7 Aug 2014 13:08:20 +0200 Subject: [PATCH] [pep8] - account_financial_report_horizontal --- .../report/__init__.py | 2 +- .../report/account_balance_sheet.py | 28 +++++++++---------- .../report/account_profit_loss.py | 14 +++++----- .../report/common_report_header.py | 4 +-- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/account_financial_report_horizontal/report/__init__.py b/account_financial_report_horizontal/report/__init__.py index 7b5a691d..84f8b2a5 100644 --- a/account_financial_report_horizontal/report/__init__.py +++ b/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 diff --git a/account_financial_report_horizontal/report/account_balance_sheet.py b/account_financial_report_horizontal/report/account_balance_sheet.py index da8c65e7..bbd6b007 100644 --- a/account_financial_report_horizontal/report/account_balance_sheet.py +++ b/account_financial_report_horizontal/report/account_balance_sheet.py @@ -24,18 +24,19 @@ 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 ( 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 +70,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 +80,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'): @@ -100,7 +99,7 @@ class report_balancesheet_horizontal( 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() @@ -124,7 +123,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 +159,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 +182,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 +224,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']): diff --git a/account_financial_report_horizontal/report/account_profit_loss.py b/account_financial_report_horizontal/report/account_profit_loss.py index 72420962..66611964 100644 --- a/account_financial_report_horizontal/report/account_profit_loss.py +++ b/account_financial_report_horizontal/report/account_profit_loss.py @@ -22,10 +22,10 @@ ############################################################################## 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 tools.translate import _ +from openerp.tools.translate import _ 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 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,7 +98,7 @@ 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) @@ -109,7 +109,7 @@ class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): types = [ 'expense', 'income' - ] + ] ctx = self.context.copy() ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) diff --git a/account_financial_report_horizontal/report/common_report_header.py b/account_financial_report_horizontal/report/common_report_header.py index e26b97df..ed7e06f3 100644 --- a/account_financial_report_horizontal/report/common_report_header.py +++ b/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):