Browse Source

[IMP] account_financial_report_webkit_xls: add more tests

pull/25/head
Anthony Muschang 10 years ago
parent
commit
e1b0cb250c
  1. 6
      account_financial_report_webkit_xls/__openerp__.py
  2. 2
      account_financial_report_webkit_xls/report/general_ledger_xls.py
  3. 4
      account_financial_report_webkit_xls/report/partner_ledger_xls.py
  4. 9
      account_financial_report_webkit_xls/report/partners_balance_xls.py
  5. 65
      account_financial_report_webkit_xls/tests/general_ledger.yml
  6. 60
      account_financial_report_webkit_xls/tests/open_invoices.yml
  7. 67
      account_financial_report_webkit_xls/tests/partner_balance.yml
  8. 60
      account_financial_report_webkit_xls/tests/partner_ledger.yml

6
account_financial_report_webkit_xls/__openerp__.py

@ -44,7 +44,11 @@
'wizard/partners_balance_wizard_view.xml', 'wizard/partners_balance_wizard_view.xml',
'wizard/open_invoices_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, 'active': False,
'installable': True, 'installable': True,
} }

2
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( row_pos = self.xls_write_row(
ws, row_pos, row_data, c_init_cell_style) 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_debit += line.get('debit') or 0.0
cumul_credit += line.get('credit') or 0.0 cumul_credit += line.get('credit') or 0.0

4
account_financial_report_webkit_xls/report/partner_ledger_xls.py

@ -216,7 +216,7 @@ class partner_ledger_xls(report_xls):
for account in objects: for account in objects:
if _p['ledger_lines'].get(account.id, False) or \ if _p['ledger_lines'].get(account.id, False) or \
_p['init_balance'].get(account.id, False): _p['init_balance'].get(account.id, False):
if not account.partners_order:
if not _p['partners_order'].get(account.id, False):
continue continue
cnt += 1 cnt += 1
account_total_debit = 0.0 account_total_debit = 0.0
@ -235,7 +235,7 @@ class partner_ledger_xls(report_xls):
row_pos += 1 row_pos += 1
for partner_name, p_id, p_ref, p_name in \ for partner_name, p_id, p_ref, p_name in \
account.partners_order:
_p['partners_order'][account.id]:
total_debit = 0.0 total_debit = 0.0
total_credit = 0.0 total_credit = 0.0

9
account_financial_report_webkit_xls/report/partners_balance_xls.py

@ -300,13 +300,15 @@ class partners_balance_xls(report_xls):
row_pos += 1 row_pos += 1
for current_account in objects: 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 # do not display accounts without partners
if not partners_order: if not partners_order:
continue 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 # in multiple columns mode, we do not want to print accounts
# without any rows # without any rows
@ -317,7 +319,8 @@ class partners_balance_xls(report_xls):
if not display_line(all_comparison_lines): if not display_line(all_comparison_lines):
continue 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'): if _p.comparison_mode in ('single', 'multiple'):
comparison_total = {} comparison_total = {}

65
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

60
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')

67
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')

60
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')
Loading…
Cancel
Save