[FIX] Hr_payroll : YML test for reports corrected

bzr revid: jvo@tinyerp.com-20100917155325-jf1u2el3f3v55lv2
This commit is contained in:
Jay (OpenERP) 2010-09-17 21:23:25 +05:30
commit 559185f39d
4 changed files with 34 additions and 13 deletions

View File

@ -72,6 +72,7 @@
<field name="wage_type_id" ref="hr_contract.hr_contract_monthly_gross"/>
<field name="name">First Contract</field>
<field name="date_start" eval="time.strftime('%Y-%m')+'-1'"/>
<field name="date_end" eval="time.strftime('%Y')+'-12-31'"/>
<field name="struct_id" ref="hr_payroll.structure_001"/>
<field name="employee_id" ref="hr_employee_bonamy0"/>
<field name="notes">This is a First Contract</field>

View File

@ -1,14 +1,14 @@
-
In order to test the PDF reports defined on HR Employee Salary, we will print HR Employee Salary
In order to test the PDF reports defined on HR Payroll, we will print Employees' Salary Structure
-
!python {model: hr.employee}: |
import netsvc, tools, os
(data, format) = netsvc.LocalService('report.salary.structure').create(cr, uid, [ref('hr_payroll.hr_employee_bonamy0')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-salary_report.'+format), 'wb+').write(data)
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-salary_structure.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on HR Payslip, we will print a HR Payslip
Print HR Payslip
-
!python {model: hr.payslip}: |
import netsvc, tools, os
@ -17,20 +17,23 @@
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payslip_report.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on HR Employee Salary Details, we will print HR Employee Salary Details
Print HR Employee Salary Details
-
!python {model: hr.payslip}: |
import netsvc, tools, os, time
data_dict = {'model': 'ir.ui.menu', 'form': {'fiscalyear_id': ref('account.data_fiscalyear'), 'employee_ids': [ref('hr.employee2')]}}
(data, format) = netsvc.LocalService('report.employees.salary').create(cr, uid, [], data_dict, {'periods': []})
emp_ids = [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')]
data_dict = {'model': 'ir.ui.menu', 'form': {'fiscalyear_id': ref('account.data_fiscalyear'), 'employee_ids': emp_ids, 'ids':emp_ids }}
(data, format) = netsvc.LocalService('report.employees.salary').create(cr, uid, [], data_dict, {'active_ids': emp_ids})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-employee_salary_detai_report.'+format), 'wb+').write(data)
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-employee_salary_detail_report.'+format), 'wb+').write(data)
-
In order to test the PDF reports defined on HR Employee Salary Details, we will print HR Employee Salary Details
Print HR Employee Salary Details Annual basis
-
!python {model: hr.payslip}: |
import netsvc, tools, os, time
data_dict = {'model': 'ir.ui.menu', 'form': {'fiscalyear_id': ref('account.data_fiscalyear'), 'salary_on': 'current_month', 'employee_ids': [ref('hr.employee2')]}}
(data, format) = netsvc.LocalService('report.year.salary').create(cr, uid, [], data_dict, {'periods': []})
emp_ids = [ref('hr.employee1'),ref('hr.employee2'),ref('hr.employee3'),ref('hr_payroll.hr_employee_bonamy0')]
data_dict = {'model': 'hr.payslip', 'form': {'fiscalyear_id': ref('account.data_fiscalyear'), 'salary_on': 'current_month', 'employee_ids': emp_ids, 'ids':emp_ids}}
(data, format) = netsvc.LocalService('report.year.salary').create(cr, uid, [], data_dict,{'active_ids': emp_ids} )
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-employee_yearly_salary_detai_report.'+format), 'wb+').write(data)
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-employee_yearly_salary_detail_report.'+format), 'wb+').write(data)

View File

@ -52,3 +52,12 @@
from tools.translate import _
advice_id=self.browse(cr, uid, ref("hr_payroll_advice_advice0"))
assert(advice_id.state == 'confirm'), _('State not changed!')
-
Print Payroll Advice
-
!python {model: hr.payroll.advice}: |
import netsvc, tools, os
(data, format) = netsvc.LocalService('report.payroll.advice').create(cr, uid, [ref('hr_payroll_advice_advice0')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payroll-advice.'+format), 'wb+').write(data)

View File

@ -1,6 +1,5 @@
-
I test the 'Payroll Register' in order to check the hr_payroll in OpenERP
-
I create a new employee “Keith”
-
!record {model: hr.employee, id: hr_employee_keith0}:
@ -61,3 +60,12 @@
from tools.translate import _
reg_brw=self.browse(cr, uid, ref("hr_payroll_register_payroll0"))
assert(reg_brw.state == 'hr_check'), _('State not changed!')
-
Print HR Payroll Register
-
!python {model: hr.payroll.register}: |
import netsvc, tools, os
(data, format) = netsvc.LocalService('report.hr.payroll.register.sheet').create(cr, uid, [ref('hr_payroll_register_payroll0')], {}, {})
if tools.config['test_report_directory']:
file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-register_report.'+format), 'wb+').write(data)