diff --git a/account_financial_report_webkit_xls/__openerp__.py b/account_financial_report_webkit_xls/__openerp__.py index 6ec5babe..40d3043f 100644 --- a/account_financial_report_webkit_xls/__openerp__.py +++ b/account_financial_report_webkit_xls/__openerp__.py @@ -44,7 +44,11 @@ 'wizard/partners_balance_wizard_view.xml', 'wizard/open_invoices_wizard_view.xml', ], - 'test': ['tests/trial_balance.yml'], + 'test': ['tests/general_ledger.yml', + 'tests/partner_ledger.yml', + 'tests/trial_balance.yml', + 'tests/partner_balance.yml', + 'tests/open_invoices.yml'], 'active': False, 'installable': True, } diff --git a/account_financial_report_webkit_xls/report/general_ledger_xls.py b/account_financial_report_webkit_xls/report/general_ledger_xls.py index 51748f8b..401ba3b7 100644 --- a/account_financial_report_webkit_xls/report/general_ledger_xls.py +++ b/account_financial_report_webkit_xls/report/general_ledger_xls.py @@ -253,7 +253,7 @@ class general_ledger_xls(report_xls): row_pos = self.xls_write_row( ws, row_pos, row_data, c_init_cell_style) - for line in account.ledger_lines: + for line in _p['ledger_lines'][account.id]: cumul_debit += line.get('debit') or 0.0 cumul_credit += line.get('credit') or 0.0 diff --git a/account_financial_report_webkit_xls/report/partner_ledger_xls.py b/account_financial_report_webkit_xls/report/partner_ledger_xls.py index 66b12762..10527974 100644 --- a/account_financial_report_webkit_xls/report/partner_ledger_xls.py +++ b/account_financial_report_webkit_xls/report/partner_ledger_xls.py @@ -216,7 +216,7 @@ class partner_ledger_xls(report_xls): for account in objects: if _p['ledger_lines'].get(account.id, False) or \ _p['init_balance'].get(account.id, False): - if not account.partners_order: + if not _p['partners_order'].get(account.id, False): continue cnt += 1 account_total_debit = 0.0 @@ -235,7 +235,7 @@ class partner_ledger_xls(report_xls): row_pos += 1 for partner_name, p_id, p_ref, p_name in \ - account.partners_order: + _p['partners_order'][account.id]: total_debit = 0.0 total_credit = 0.0 diff --git a/account_financial_report_webkit_xls/report/partners_balance_xls.py b/account_financial_report_webkit_xls/report/partners_balance_xls.py index 8bf1cfeb..7c16af9c 100644 --- a/account_financial_report_webkit_xls/report/partners_balance_xls.py +++ b/account_financial_report_webkit_xls/report/partners_balance_xls.py @@ -300,13 +300,15 @@ class partners_balance_xls(report_xls): row_pos += 1 for current_account in objects: - partners_order = current_account.partners_order + partners_order = _p['partners_order_accounts']\ + .get(current_account.id, False) # do not display accounts without partners if not partners_order: continue - comparisons = current_account.comparisons + comparisons = _p['comparisons_accounts']\ + .get(current_account.id, False) # in multiple columns mode, we do not want to print accounts # without any rows @@ -317,7 +319,8 @@ class partners_balance_xls(report_xls): if not display_line(all_comparison_lines): continue - current_partner_amounts = current_account.partners_amounts + current_partner_amounts = _p['partners_amounts_accounts']\ + .get(current_account.id, False) if _p.comparison_mode in ('single', 'multiple'): comparison_total = {} diff --git a/account_financial_report_webkit_xls/tests/general_ledger.yml b/account_financial_report_webkit_xls/tests/general_ledger.yml new file mode 100644 index 00000000..b7a4d4a2 --- /dev/null +++ b/account_financial_report_webkit_xls/tests/general_ledger.yml @@ -0,0 +1,65 @@ +- + In order to test the Excel General Ledger webkit wizard I will print report with default setting +- + !python {model: account.account}: | + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0')} + ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel General Ledger webkit wizard I will print report with posted move +- + !python {model: account.account}: | + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'target_move': 'posted'} + ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel General Ledger webkit wizard I will print report with transactions or non zero balance +- + !python {model: account.account}: | + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'display_account': 'bal_mix'} + ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel General Ledger webkit wizard I will print report with inital balance and currency ammount +- + !python {model: account.account}: | + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'amount_currency': 1} + ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +#Filter by date +- + In order to test the Excel General Ledger webkit wizard I will print report with inital balance and currency ammount and I filter by date of the first tree month +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'),'amount_currency': 1, 'chart_account_id': 1, 'date_from': '%s-01-01' %(datetime.now().year), + 'date_to':'%s-04-01' %(datetime.now().year), 'display_account': 'bal_all', 'filter': 'filter_date',} + ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel General Ledger webkit wizard I will print report with inital balance and currency ammount and I filter by date of the first tree month +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'),'amount_currency': 1, 'chart_account_id': 1, 'date_from': '%s-01-01' %(datetime.now().year), + 'date_to':'%s-04-01' %(datetime.now().year), 'display_account': 'bal_all', 'filter': 'filter_date',} + ctx.update({'model': 'account.account','active_ids':[ref('account.chart0')],'active_id':ref('account.chart0')}) + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_general_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') +# I still have to parse report content but for this I need accounting data on multiple exercises and faor all fiscal year diff --git a/account_financial_report_webkit_xls/tests/open_invoices.yml b/account_financial_report_webkit_xls/tests/open_invoices.yml new file mode 100644 index 00000000..65fc736b --- /dev/null +++ b/account_financial_report_webkit_xls/tests/open_invoices.yml @@ -0,0 +1,60 @@ +- + In order to test the Excel Open Invoices Report webkit wizard I will print report with default setting +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'until_date': '%s-12-31' %(datetime.now().year)} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Open Invoices Report webkit wizard I will print report with filters and currency +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', + 'amount_currency': True, 'result_selection': 'customer_supplier'} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Open Invoices Report webkit wizard I will print report with filters on partners +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', + 'amount_currency': True, 'result_selection': 'customer_supplier', + 'partner_ids': [ref('base.res_partner_2'), ref('base.res_partner_1')]} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Open Invoices Report webkit wizard I will print report with filters on periods +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', + 'amount_currency': True, 'result_selection': 'customer_supplier', + 'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Open Invoices Report webkit wizard I will print report with filters on dates +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', + 'amount_currency': True, 'result_selection': 'customer_supplier', + 'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_open_invoices_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') diff --git a/account_financial_report_webkit_xls/tests/partner_balance.yml b/account_financial_report_webkit_xls/tests/partner_balance.yml new file mode 100644 index 00000000..72d67c1f --- /dev/null +++ b/account_financial_report_webkit_xls/tests/partner_balance.yml @@ -0,0 +1,67 @@ +- + In order to test the Excel Partner Balance webkit wizard I will print report with default setting +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0')} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export', our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Balance webkit wizard I will print report as if we print it from an account +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0')} + ctx.update({'model': 'account.account','active_ids':[ref('account.assets_view'), ref('account.liabilities_view')],'active_id': ref('account.assets_view')}) + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export', our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Balance webkit wizard I will print report with filters on period +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export', our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Balance webkit wizard I will print report with filters on dates +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export', our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Balance webkit wizard I will print report with one comparison filtered by year +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'comp0_filter': 'filter_year', 'comp0_fiscalyear_id': ref('account.data_fiscalyear')} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export', our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Balance webkit wizard I will print report with all comparisons filtered by year, period and date +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'comp0_filter': 'filter_year', 'comp0_fiscalyear_id': ref('account.data_fiscalyear'), + 'comp1_filter': 'filter_period', 'comp1_period_from': ref('account.period_1'), 'comp1_period_to': ref('account.period_12'), + 'comp2_filter': 'filter_date', 'comp2_date_from': '%s-01-01' %(datetime.now().year), 'comp2_date_to': '%s-12-31' %(datetime.now().year) + } + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partner_balance_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') diff --git a/account_financial_report_webkit_xls/tests/partner_ledger.yml b/account_financial_report_webkit_xls/tests/partner_ledger.yml new file mode 100644 index 00000000..4a25dcd7 --- /dev/null +++ b/account_financial_report_webkit_xls/tests/partner_ledger.yml @@ -0,0 +1,60 @@ +- + In order to test the Excel Partner Ledger webkit wizard I will print report with default setting +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'until_date': '%s-12-31' %(datetime.now().year)} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Ledger webkit wizard I will print report with filters and currency +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', + 'amount_currency': True, 'result_selection': 'customer_supplier'} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Ledger webkit wizard I will print report with filters on partners +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', + 'amount_currency': True, 'result_selection': 'customer_supplier', + 'partner_ids': [ref('base.res_partner_2'), ref('base.res_partner_1')]} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Ledger webkit wizard I will print report with filters on periods +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', + 'amount_currency': True, 'result_selection': 'customer_supplier', + 'filter': 'filter_period', 'period_from': ref('account.period_1'), 'period_to': ref('account.period_12')} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls') + +- + In order to test the Excel Partner Ledger webkit wizard I will print report with filters on dates +- + !python {model: account.account}: | + from datetime import datetime + ctx={'xls_export':1} + data_dict = {'chart_account_id':ref('account.chart0'), 'fiscalyear_id': ref('account.data_fiscalyear'), + 'until_date': '%s-12-31' %(datetime.now().year), 'target_move': 'posted', + 'amount_currency': True, 'result_selection': 'customer_supplier', + 'filter': 'filter_date', 'date_from': '%s-01-01' %(datetime.now().year), 'date_to': '%s-12-31' %(datetime.now().year)} + from openerp.tools import test_reports + test_reports.try_report_action(cr, uid, 'account_financial_report_webkit.action_account_partners_ledger_menu_webkit',wiz_data=data_dict, context=ctx, wiz_buttons='xls_export',our_module='account_financial_report_webkit_xls')