From 8ec0108649dd736dd24ee67f674010219a06e6f2 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Fri, 9 Dec 2011 17:25:58 +0100 Subject: [PATCH] [REM] account: removal of deprecated account reports for balance sheet and profit/loss bzr revid: qdp-launchpad@openerp.com-20111209162558-xigtewgren97xuk5 --- addons/account/__openerp__.py | 2 - addons/account/report/__init__.py | 2 - addons/account/report/account_balance_sheet.py | 224 -------------- addons/account/report/account_balance_sheet.rml | 303 ------------------- .../report/account_balance_sheet_horizontal.rml | 250 ---------------- .../account/report/account_profit_horizontal.rml | 282 ------------------ addons/account/report/account_profit_loss.py | 198 ------------ addons/account/report/account_profit_loss.rml | 314 -------------------- addons/account/wizard/__init__.py | 3 - .../account/wizard/account_report_balance_sheet.py | 85 ------ .../wizard/account_report_balance_sheet_view.xml | 50 ---- .../account/wizard/account_report_profit_loss.py | 62 ---- .../wizard/account_report_profit_loss_view.xml | 49 --- 13 files changed, 1824 deletions(-) delete mode 100644 addons/account/report/account_balance_sheet.py delete mode 100644 addons/account/report/account_balance_sheet.rml delete mode 100644 addons/account/report/account_balance_sheet_horizontal.rml delete mode 100644 addons/account/report/account_profit_horizontal.rml delete mode 100644 addons/account/report/account_profit_loss.py delete mode 100644 addons/account/report/account_profit_loss.rml delete mode 100644 addons/account/wizard/account_report_balance_sheet.py delete mode 100644 addons/account/wizard/account_report_balance_sheet_view.xml delete mode 100644 addons/account/wizard/account_report_profit_loss.py delete mode 100644 addons/account/wizard/account_report_profit_loss_view.xml diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index ea6142b..e01dbc7 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -123,8 +123,6 @@ module named account_voucher. 'ir_sequence_view.xml', 'company_view.xml', 'board_account_view.xml', - #"wizard/account_report_profit_loss_view.xml", - #"wizard/account_report_balance_sheet_view.xml", "edi/invoice_action_data.xml", "account_bank_view.xml", "account_pre_install.yml" diff --git a/addons/account/report/__init__.py b/addons/account/report/__init__.py index f7d82ff..78d369f 100644 --- a/addons/account/report/__init__.py +++ b/addons/account/report/__init__.py @@ -38,8 +38,6 @@ import account_invoice_report import account_report import account_entries_report import account_analytic_entries_report -#import account_balance_sheet -#import account_profit_loss import account_treasury_report import account_financial_report diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py deleted file mode 100644 index ce9e3c5..0000000 --- a/addons/account/report/account_balance_sheet.py +++ /dev/null @@ -1,224 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import time - -import pooler -from report import report_sxw -from account.report import account_profit_loss -from common_report_header import common_report_header -from 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) - self.obj_pl = account_profit_loss.report_pl_account_horizontal(cr, uid, name, context=context) - self.result_sum_dr = 0.0 - self.result_sum_cr = 0.0 - self.result = {} - self.res_bl = {} - self.result_temp = [] - self.localcontext.update({ - 'time': time, - 'get_lines': self.get_lines, - 'get_lines_another': self.get_lines_another, - 'get_company': self._get_company, - 'get_currency': self._get_currency, - 'sum_dr': self.sum_dr, - 'sum_cr': self.sum_cr, - 'get_data':self.get_data, - 'get_pl_balance':self.get_pl_balance, - 'get_fiscalyear': self._get_fiscalyear, - 'get_account': self._get_account, - 'get_start_period': self.get_start_period, - 'get_end_period': self.get_end_period, - 'get_sortby': self._get_sortby, - 'get_filter': self._get_filter, - 'get_journal': self._get_journal, - 'get_start_date':self._get_start_date, - 'get_end_date':self._get_end_date, - 'get_company':self._get_company, - 'get_target_move': self._get_target_move, - }) - self.context = context - - 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']] or [] - objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) - return super(report_balancesheet_horizontal, self).set_context(objects, data, new_ids, report_type=report_type) - - def sum_dr(self): - if self.res_bl['type'] == _('Net Profit'): - self.result_sum_dr += self.res_bl['balance']*-1 - return self.result_sum_dr - - def sum_cr(self): - if self.res_bl['type'] == _('Net Loss'): - self.result_sum_cr += self.res_bl['balance'] - return self.result_sum_cr - - def get_pl_balance(self): - return self.res_bl - - 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 - 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') - - types = [ - 'liability', - 'asset' - ] - - ctx = self.context.copy() - ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) - - if data['form']['filter'] == 'filter_period': - ctx['period_from'] = data['form'].get('period_from', False) - ctx['period_to'] = data['form'].get('period_to', False) - elif data['form']['filter'] == 'filter_date': - ctx['date_from'] = data['form'].get('date_from', False) - 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) - account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx) - accounts = account_pool.browse(cr, uid, account_ids, context=ctx) - - if not self.res_bl: - self.res_bl['type'] = _('Net Profit') - self.res_bl['balance'] = 0.0 - - if self.res_bl['type'] == _('Net Profit'): - self.res_bl['type'] = _('Net Profit') - else: - self.res_bl['type'] = _('Net Loss') - pl_dict = { - 'code': self.res_bl['type'], - 'name': self.res_bl['type'], - 'level': False, - 'balance':self.res_bl['balance'], - } - for typ in types: - accounts_temp = [] - for account in accounts: - if (account.user_type.report_type) and (account.user_type.report_type == typ): - account_dict = { - 'id': account.id, - 'code': account.code, - 'name': account.name, - 'level': account.level, - 'balance': account.balance != 0 and account.balance * account.user_type.sign or 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): - self.result_sum_dr += account.balance - if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit): - self.result_sum_cr += account.balance - if data['form']['display_account'] == 'movement': - if not currency_pool.is_zero(self.cr, self.uid, currency, account.credit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.debit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.balance): - accounts_temp.append(account_dict) - elif data['form']['display_account'] == 'not_zero': - if not currency_pool.is_zero(self.cr, self.uid, currency, account.balance): - accounts_temp.append(account_dict) - else: - accounts_temp.append(account_dict) - if account.id == data['form']['reserve_account_id']: - pl_dict['level'] = account['level'] + 1 - accounts_temp.append(pl_dict) - - self.result[typ] = accounts_temp - cal_list[typ]=self.result[typ] - - if cal_list: - temp = {} - for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))): - if i < len(cal_list['liability']) and i < len(cal_list['asset']): - temp={ - 'type': cal_list['liability'][i]['type'], - 'code': cal_list['liability'][i]['code'], - 'name': cal_list['liability'][i]['name'], - 'level': cal_list['liability'][i]['level'], - 'balance':cal_list['liability'][i]['balance'], - 'type1': cal_list['asset'][i]['type'], - 'code1': cal_list['asset'][i]['code'], - 'name1': cal_list['asset'][i]['name'], - 'level1': cal_list['asset'][i]['level'], - 'balance1':cal_list['asset'][i]['balance'], - } - self.result_temp.append(temp) - else: - if i < len(cal_list['asset']): - temp={ - 'type': '', - 'code': '', - 'name': '', - 'level': False, - 'balance':False, - 'type1': cal_list['asset'][i]['type'], - 'code1': cal_list['asset'][i]['code'], - 'name1': cal_list['asset'][i]['name'], - 'level1': cal_list['asset'][i]['level'], - 'balance1':cal_list['asset'][i]['balance'], - } - self.result_temp.append(temp) - if i < len(cal_list['liability']): - temp={ - 'type': cal_list['liability'][i]['type'], - 'code': cal_list['liability'][i]['code'], - 'name': cal_list['liability'][i]['name'], - 'level': cal_list['liability'][i]['level'], - 'balance':cal_list['liability'][i]['balance'], - 'type1': '', - 'code1': '', - 'name1': '', - 'level1': False, - 'balance1':False, - } - self.result_temp.append(temp) - return None - - def get_lines(self): - return self.result_temp - - def get_lines_another(self, group): - return self.result.get(group, []) - -report_sxw.report_sxw('report.account.balancesheet.horizontal', 'account.account', - 'addons/account/report/account_balance_sheet_horizontal.rml',parser=report_balancesheet_horizontal, - header='internal landscape') - -report_sxw.report_sxw('report.account.balancesheet', 'account.account', - 'addons/account/report/account_balance_sheet.rml',parser=report_balancesheet_horizontal, - header='internal') - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/account_balance_sheet.rml b/addons/account/report/account_balance_sheet.rml deleted file mode 100644 index 620ec05..0000000 --- a/addons/account/report/account_balance_sheet.rml +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Balance Sheet - - - - [[ get_data(data) or removeParentNode('para') ]] - - - - - - Chart of Accounts - Fiscal Year - Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] - Display Account - Target Moves - - - [[ get_account(data) or removeParentNode('para') ]] - [[ get_fiscalyear(data) or '' ]] - [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] - [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] - - Start Date - End Date - - - [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] - - - [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] - - Start Period - End Period - - - [[ get_start_period(data) or removeParentNode('para') ]] - [[ get_end_period(data) or removeParentNode('para') ]] - - - - [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] - [[ get_target_move(data) ]] - - - - - - - - - - - - Assets - - - - - - - - - - Code - - - Account - - - Balance - - - - [[ repeatIn(get_lines_another('asset'),'a' ) ]] - [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]] - [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]][[ a['code'] ]] - [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]] - [[ (a['level'] <>2) or removeParentNode('td') ]][[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency_obj = company.currency_id) ]] - [[ a['level'] == 2 or removeParentNode('td') ]][[ formatLang(a['balance'], currency_obj = company.currency_id) ]] - - - - - - Balance: - - - [[ formatLang(sum_cr(), currency_obj = company.currency_id) ]] - - - - - - - - - - - Liabilities - - - - - - - Code - - - Account - - - Balance - - - - [[ repeatIn(get_lines_another('liability'),'a' ) ]] - [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a['level']))}) ]] - [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_code'}) ]][[ a['code'] ]] - [[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a['level']))+'_name'}) ]][[ a['name'] ]] - [[ (a['level'] <>2) or removeParentNode('td') ]][[ (a['type'] =='view' and a['level'] >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a['level']))+'_balance'}) ]][[ formatLang(a['balance'], currency_obj = company.currency_id) ]] - [[ a['level'] == 2 or removeParentNode('td') ]][[ formatLang(a['balance'], currency_obj = company.currency_id) ]] - - - - - - Balance: - - - [[ formatLang(sum_dr(), currency_obj = company.currency_id) ]] - - - - - - - - diff --git a/addons/account/report/account_balance_sheet_horizontal.rml b/addons/account/report/account_balance_sheet_horizontal.rml deleted file mode 100644 index b2d54e3..0000000 --- a/addons/account/report/account_balance_sheet_horizontal.rml +++ /dev/null @@ -1,250 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Balance Sheet - - - - [[ get_data(data) or removeParentNode('para') ]] - - - - Chart of Accounts - Fiscal Year - Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] - Display Account - Target Moves - - - [[ get_account(data) or removeParentNode('para') ]] - [[ get_fiscalyear(data) or '' ]] - [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] - [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] - - Start Date - End Date - - - [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] - - - [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] - - Start Period - End Period - - - [[ get_start_period(data) or removeParentNode('para') ]] - [[ get_end_period(data) or removeParentNode('para') ]] - - - - [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] - [[ get_target_move(data) ]] - - - - - - - - - - - - Code - - - Assets - - - Balance - - - Code - - - Liabilities - - - Balance - - - - - - [[ repeatIn(get_lines(),'a' ) ]] [[ a['code1'] ]][[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]] - - - - - [[ '. '*(a['level1']-1) ]][[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name1'] ]] - - - - - [[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(a['balance1'], currency_obj=company.currency_id) ]] - - - - - [[ a['code'] ]][[ ( a['level']<4 or a['name']=='Net Profit') and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]] - - - - - [[ '. '*(a['level']-1) ]] - [[ ( a['level']<4 or a['name']=='Net Profit') and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name'] ]] - - - - - [[ ( a['level']<4 or a['name']=='Net Profit') and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]] - [[(a['code'] and a['name']) and formatLang(a['balance'], currency_obj=company.currency_id) or removeParentNode('font')]] - - - - - - - - Balance: - - - [[ formatLang(sum_cr(), currency_obj=company.currency_id) ]] - - - Balance: - - - [[ formatLang(sum_dr(), currency_obj=company.currency_id) ]] - - - - - - diff --git a/addons/account/report/account_profit_horizontal.rml b/addons/account/report/account_profit_horizontal.rml deleted file mode 100644 index 0918dcb..0000000 --- a/addons/account/report/account_profit_horizontal.rml +++ /dev/null @@ -1,282 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Profit And Loss - - - - - - - [[ get_data(data) or removeParentNode('para')]] - - - Chart of Accounts - Fiscal Year - Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] - Display Account - Target Moves - - - [[ get_account(data) or removeParentNode('para') ]] - [[ get_fiscalyear(data) or '' ]] - [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] - [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] - - Start Date - End Date - - - [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] - - - [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] - - Start Period - End Period - - - [[ get_start_period(data) or removeParentNode('para') ]] - [[ get_end_period(data) or removeParentNode('para') ]] - - - - [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] - [[ get_target_move(data) ]] - - - - - - - - - Code - - - Expenses - - - Balance - - - Code - - - Income - - - Balance - - - - - - - [[ repeatIn(get_lines(),'a' ) ]] [[ a['code'] ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]] - - - - - [[ '. '*(a['level']-1) ]][[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name'] ]] - - - - [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[ formatLang(abs(a['balance']), currency_obj=company.currency_id) ]] - - - - [[ a['code1'] ]][[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]] - - - - - [[ '. '*(a['level1']-1) ]][[ a['level1']<4 and ( setTag('para','para',{'style':'terp_default_Bold_9'})) or removeParentNode('font') ]][[ a['name1'] ]] - - - - [[ a['level']<4 and ( setTag('para','para',{'style':'terp_default_Right_9_Bold'})) or removeParentNode('font') ]][[(a['code1'] and a['name1']) and formatLang(abs(a['balance1']), currency_obj=company.currency_id) or removeParentNode('font') ]] - - - - - - - - - - [[ final_result()['type'] == 'Net Profit' and final_result()['type'] or '' ]] - - - [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(abs(final_result()['balance']), currency_obj=company.currency_id) ]] - - - - - - [[ final_result()['type'] == 'Net Loss' and final_result()['type'] or '' ]] - - - [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(abs(final_result()['balance']), currency_obj=company.currency_id) ]] - - - - - - - - Total: - - - [[ formatLang(abs(sum_dr()), currency_obj=company.currency_id) ]] - - - Total: - - - [[ formatLang(abs(sum_cr()), currency_obj=company.currency_id) ]] - - - - - - diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py deleted file mode 100644 index 27182cd..0000000 --- a/addons/account/report/account_profit_loss.py +++ /dev/null @@ -1,198 +0,0 @@ -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import time -import pooler -from report import report_sxw -from common_report_header import common_report_header -from tools.translate import _ - -class report_pl_account_horizontal(report_sxw.rml_parse, common_report_header): - - def __init__(self, cr, uid, name, context=None): - super(report_pl_account_horizontal, self).__init__(cr, uid, name, context=context) - self.result_sum_dr = 0.0 - self.result_sum_cr = 0.0 - self.res_pl = {} - self.result = {} - self.result_temp = [] - self.localcontext.update( { - 'time': time, - 'get_lines': self.get_lines, - 'get_lines_another': self.get_lines_another, - 'get_currency': self._get_currency, - 'get_data': self.get_data, - 'sum_dr': self.sum_dr, - 'sum_cr': self.sum_cr, - 'final_result': self.final_result, - 'get_fiscalyear': self._get_fiscalyear, - 'get_account': self._get_account, - 'get_start_period': self.get_start_period, - 'get_end_period': self.get_end_period, - 'get_sortby': self._get_sortby, - 'get_filter': self._get_filter, - 'get_journal': self._get_journal, - 'get_start_date':self._get_start_date, - 'get_end_date':self._get_end_date, - 'get_company':self._get_company, - 'get_target_move': self._get_target_move, - }) - self.context = context - - 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']] or [] - objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids) - return super(report_pl_account_horizontal, self).set_context(objects, data, new_ids, report_type=report_type) - - - def final_result(self): - return self.res_pl - - def sum_dr(self): - if self.res_pl['type'] == _('Net Profit'): - self.result_sum_dr += self.res_pl['balance'] - return self.result_sum_dr - - def sum_cr(self): - if self.res_pl['type'] == _('Net Loss'): - self.result_sum_cr += self.res_pl['balance'] - return self.result_sum_cr - - def get_data(self, data): - 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') - - types = [ - 'expense', - 'income' - ] - - ctx = self.context.copy() - ctx['fiscalyear'] = data['form'].get('fiscalyear_id', False) - - if data['form']['filter'] == 'filter_period': - ctx['period_from'] = data['form'].get('period_from', False) - ctx['period_to'] = data['form'].get('period_to', False) - elif data['form']['filter'] == 'filter_date': - ctx['date_from'] = data['form'].get('date_from', False) - ctx['date_to'] = data['form'].get('date_to', False) - - cal_list = {} - account_id = data['form'].get('chart_account_id', False) - company_currency = account_pool.browse(self.cr, self.uid, account_id).company_id.currency_id - account_ids = account_pool._get_children_and_consol(cr, uid, account_id, context=ctx) - accounts = account_pool.browse(cr, uid, account_ids, context=ctx) - - for typ in types: - accounts_temp = [] - for account in accounts: - if (account.user_type.report_type) and (account.user_type.report_type == typ): - currency = account.currency_id and account.currency_id or account.company_id.currency_id - if typ == 'expense' and account.type <> 'view' and (account.debit <> account.credit): - self.result_sum_dr += account.debit - account.credit - if typ == 'income' and account.type <> 'view' and (account.debit <> account.credit): - self.result_sum_cr += account.credit - account.debit - if data['form']['display_account'] == 'movement': - if not currency_pool.is_zero(self.cr, self.uid, currency, account.credit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.debit) or not currency_pool.is_zero(self.cr, self.uid, currency, account.balance): - accounts_temp.append(account) - elif data['form']['display_account'] == 'not_zero': - if not currency_pool.is_zero(self.cr, self.uid, currency, account.balance): - accounts_temp.append(account) - else: - accounts_temp.append(account) - if currency_pool.is_zero(self.cr, self.uid, company_currency, (self.result_sum_dr-self.result_sum_cr)): - self.res_pl['type'] = None - self.res_pl['balance'] = 0.0 - elif self.result_sum_dr > self.result_sum_cr: - self.res_pl['type'] = _('Net Loss') - self.res_pl['balance'] = (self.result_sum_dr - self.result_sum_cr) - else: - self.res_pl['type'] = _('Net Profit') - self.res_pl['balance'] = (self.result_sum_cr - self.result_sum_dr) - self.result[typ] = accounts_temp - cal_list[typ] = self.result[typ] - if cal_list: - temp = {} - for i in range(0,max(len(cal_list['expense']),len(cal_list['income']))): - if i < len(cal_list['expense']) and i < len(cal_list['income']): - temp={ - 'code': cal_list['expense'][i].code, - 'name': cal_list['expense'][i].name, - 'level': cal_list['expense'][i].level, - 'balance': cal_list['expense'][i].balance != 0 and \ - cal_list['expense'][i].balance * cal_list['expense'][i].user_type.sign or \ - cal_list['expense'][i].balance, - 'code1': cal_list['income'][i].code, - 'name1': cal_list['income'][i].name, - 'level1': cal_list['income'][i].level, - 'balance1': cal_list['income'][i].balance != 0 and \ - cal_list['income'][i].balance * cal_list['income'][i].user_type.sign or \ - cal_list['income'][i].balance, - } - self.result_temp.append(temp) - else: - if i < len(cal_list['income']): - temp={ - 'code': '', - 'name': '', - 'level': False, - 'balance':False, - 'code1': cal_list['income'][i].code, - 'name1': cal_list['income'][i].name, - 'level1': cal_list['income'][i].level, - 'balance1': cal_list['income'][i].balance != 0 and \ - cal_list['income'][i].balance * cal_list['income'][i].user_type.sign \ - or cal_list['income'][i].balance, - } - self.result_temp.append(temp) - if i < len(cal_list['expense']): - temp={ - 'code': cal_list['expense'][i].code, - 'name': cal_list['expense'][i].name, - 'level': cal_list['expense'][i].level, - 'balance': cal_list['expense'][i].balance != 0 and \ - cal_list['expense'][i].balance * cal_list['expense'][i].user_type.sign \ - or cal_list['expense'][i].balance, - 'code1': '', - 'name1': '', - 'level1': False, - 'balance1':False, - } - self.result_temp.append(temp) - return None - - def get_lines(self): - return self.result_temp - - def get_lines_another(self, group): - return self.result.get(group, []) - -report_sxw.report_sxw('report.pl.account.horizontal', 'account.account', - 'addons/account/report/account_profit_horizontal.rml',parser=report_pl_account_horizontal, header='internal landscape') - -report_sxw.report_sxw('report.pl.account', 'account.account', - 'addons/account/report/account_profit_loss.rml',parser=report_pl_account_horizontal, header='internal') - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/report/account_profit_loss.rml b/addons/account/report/account_profit_loss.rml deleted file mode 100644 index 28fe167..0000000 --- a/addons/account/report/account_profit_loss.rml +++ /dev/null @@ -1,314 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Profit And Loss - - - - - [[ get_data(data) or removeParentNode('para')]] - - - - - - Chart of Accounts - Fiscal Year - Filter By [[ data['form']['filter']!='filter_no' and get_filter(data) ]] - Display Account - Target Moves - - - [[ get_account(data) or removeParentNode('para') ]] - [[ get_fiscalyear(data) or '' ]] - [[ data['form']['filter']=='filter_no' and get_filter(data) or removeParentNode('para') ]] - [[ data['form']['filter']=='filter_date' or removeParentNode('blockTable') ]] - - Start Date - End Date - - - [[ formatLang(get_start_date(data),date=True) ]] - [[ formatLang(get_end_date(data),date=True) ]] - - - [[ data['form']['filter']=='filter_period' or removeParentNode('blockTable') ]] - - Start Period - End Period - - - [[ get_start_period(data) or removeParentNode('para') ]] - [[ get_end_period(data) or removeParentNode('para') ]] - - - - [[ (data['form']['display_account']=='all' and 'All') or (data['form']['display_account']=='movement' and 'With movements') or 'With balance is not equal to 0']] - [[ get_target_move(data) ]] - - - - - - Expenses - - - - Code - - - Account - - - Balance - - - - [[ repeatIn(get_lines_another('expense'),'a' ) ]] - [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]] - [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]][[ a.code ]] - [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]] - [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]] - [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]] - - - - - - - - - [[ final_result()['type'] == 'Net Profit' and final_result()['type'] or removeParentNode('blockTable') ]] - - - [[ final_result()['balance'] and final_result()['type'] == 'Net Profit' and formatLang(final_result()['balance'], currency_obj=company.currency_id) ]] - - - - - - - Total: - - - [[ formatLang(sum_dr(), currency_obj=company.currency_id) ]] - - - - - - - - Incomes - - - - Code - - - Account - - - Balance - - - - [[ repeatIn(get_lines_another('income'),'a' ) ]] - [[ setTag('tr','tr',{'style': 'Table'+str(min(3,a.level))}) ]] - [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_code_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_code'}) ]][[ a.code ]] - [[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_name_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(4,a.level))+'_name'}) ]][[ a.name ]] - [[ (a.level <>2) or removeParentNode('td') ]][[ (a.type =='view' and a.level >= 3) and setTag('para','para',{'style': 'terp_level_3_balance_bold'}) or setTag('para','para',{'style': 'terp_level_'+str(min(3,a.level))+'_balance'}) ]][[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]] - [[ a.level == 2 or removeParentNode('td') ]][[ formatLang(a.balance * a.user_type.sign, currency_obj=company.currency_id) ]] - - - - - - - - - [[ final_result()['type'] == 'Net Loss' and final_result()['type'] or removeParentNode('blockTable') ]] - - - [[ final_result()['balance'] and final_result()['type'] == 'Net Loss' and formatLang(final_result()['balance'], currency_obj=company.currency_id) ]] - - - - - - - Total: - - - [[ formatLang(sum_cr(), currency_obj=company.currency_id) ]] - - - - - - - - - - - diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py index bef2c78..a78cf12 100644 --- a/addons/account/wizard/__init__.py +++ b/addons/account/wizard/__init__.py @@ -64,9 +64,6 @@ import account_report_account_balance import account_change_currency -#import account_report_balance_sheet -#import account_report_profit_loss - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py deleted file mode 100644 index 01a8916..0000000 --- a/addons/account/wizard/account_report_balance_sheet.py +++ /dev/null @@ -1,85 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from osv import osv, fields -from tools.translate import _ - -class account_bs_report(osv.osv_memory): - """ - This wizard will provide the account balance sheet report by periods, between any two dates. - """ - _name = 'account.bs.report' - _inherit = "account.common.account.report" - _description = 'Account Balance Sheet Report' - - def _get_def_reserve_account(self, cr, uid, context=None): - chart_id = self._get_account(cr, uid, context=context) - res = self.onchange_chart_id(cr, uid, [], chart_id, context=context) - if not res: - return False - return res['value']['reserve_account_id'] - - _columns = { - 'display_type': fields.boolean("Landscape Mode"), - 'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account', - help='This account is used for transferring Profit/Loss (If It is Profit: Amount will be added, Loss : Amount will be deducted.), as calculated in Profit & Loss Report', - domain = [('type','=','other')]), - 'journal_ids': fields.many2many('account.journal', 'account_bs_report_journal_rel', 'account_id', 'journal_id', 'Journals', required=True), - } - - _defaults={ - 'display_type': False, - 'journal_ids': [], - 'reserve_account_id': _get_def_reserve_account, - } - - def onchange_chart_id(self, cr, uid, ids, chart_id, context=None): - if not chart_id: - return {} - account = self.pool.get('account.account').browse(cr, uid, chart_id , context=context) - if not account.company_id.property_reserve_and_surplus_account: - return {'value': {'reserve_account_id': False}} - return {'value': {'reserve_account_id': account.company_id.property_reserve_and_surplus_account.id}} - - - def _print_report(self, cr, uid, ids, data, context=None): - if context is None: - context = {} - data['form'].update(self.read(cr, uid, ids, ['display_type','reserve_account_id'])[0]) - if not data['form']['reserve_account_id']: - raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !')) - data = self.pre_print_report(cr, uid, ids, data, context=context) - if data['form']['display_type']: - return { - 'type': 'ir.actions.report.xml', - 'report_name': 'account.balancesheet.horizontal', - 'datas': data, - } - else: - return { - 'type': 'ir.actions.report.xml', - 'report_name': 'account.balancesheet', - 'datas': data, - } - -account_bs_report() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_report_balance_sheet_view.xml b/addons/account/wizard/account_report_balance_sheet_view.xml deleted file mode 100644 index faac523..0000000 --- a/addons/account/wizard/account_report_balance_sheet_view.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - Account Balance Sheet - account.bs.report - form - - - - - - - - - - - - - - - - - - - - - - - - Balance Sheet - account.bs.report - ir.actions.act_window - form - form - - new - - - - - - diff --git a/addons/account/wizard/account_report_profit_loss.py b/addons/account/wizard/account_report_profit_loss.py deleted file mode 100644 index f4c2897..0000000 --- a/addons/account/wizard/account_report_profit_loss.py +++ /dev/null @@ -1,62 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from osv import osv, fields - -class account_pl_report(osv.osv_memory): - """ - This wizard will provide the account profit and loss report by periods, between any two dates. - """ - _inherit = "account.common.account.report" - _name = "account.pl.report" - _description = "Account Profit And Loss Report" - - _columns = { - 'display_type': fields.boolean("Landscape Mode"), - 'journal_ids': fields.many2many('account.journal', 'account_pl_report_journal_rel', 'account_id', 'journal_id', 'Journals', required=True), - } - - _defaults = { - 'display_type': False, - 'journal_ids': [], - } - - def _print_report(self, cr, uid, ids, data, context=None): - if context is None: - context = {} - data = self.pre_print_report(cr, uid, ids, data, context=context) - data['form'].update(self.read(cr, uid, ids, ['display_type'])[0]) - if data['form']['display_type']: - return { - 'type': 'ir.actions.report.xml', - 'report_name': 'pl.account.horizontal', - 'datas': data, - } - else: - return { - 'type': 'ir.actions.report.xml', - 'report_name': 'pl.account', - 'datas': data, - } - -account_pl_report() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_report_profit_loss_view.xml b/addons/account/wizard/account_report_profit_loss_view.xml deleted file mode 100644 index 75b6766..0000000 --- a/addons/account/wizard/account_report_profit_loss_view.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - Profit and Loss - account.pl.report - form - - - - - - - - - - - - - - - - - - - Account Profit And Loss - account.pl.report - ir.actions.act_window - form - form - - new - - - - - - - - -- 1.7.10.4