65 lines
2.6 KiB
YAML
65 lines
2.6 KiB
YAML
-
|
|
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}:
|
|
address_home_id: base.res_partner_address_3
|
|
address_id: base.res_partner_address_9
|
|
birthday: '1984-05-01'
|
|
children: 0.0
|
|
contract_ids:
|
|
- advantages_gross: 0.0
|
|
advantages_net: 0.0
|
|
date_end: !eval "'%s-%s-%s' %(datetime.now().year+1,datetime.now().month,datetime.now().day)"
|
|
date_start: !eval time.strftime('%Y-%m-%d')
|
|
name: reference
|
|
wage: 5000.0
|
|
wage_type_id: hr_contract.hr_contract_monthly_gross
|
|
type_id: hr_contract.hr_contract_type_emp
|
|
country_id: base.in
|
|
department_id: hr.dep_it
|
|
gender: male
|
|
marital: hr.hr_employee_marital_status_single
|
|
name: Keith
|
|
vehicle_distance: 0.0
|
|
-
|
|
I create a payroll register record.
|
|
-
|
|
!record {model: hr.payroll.register, id: hr_payroll_register_payroll0}:
|
|
date: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month,datetime.now().day+1)"
|
|
line_ids:
|
|
- employee_id: hr_payroll.hr_employee_keith0
|
|
name: payroll1
|
|
-
|
|
I click on Compute button.
|
|
-
|
|
!python {model: hr.payroll.register}: |
|
|
self.compute_sheet(cr, uid, [ref("hr_payroll_register_payroll0")], {"lang": "en_US",
|
|
"tz": False, "active_model": "ir.ui.menu", "department_id": False, "active_ids":
|
|
[ref("hr_payroll.hr_menu_payroll_register")], "section_id": False, "active_id":
|
|
ref("hr_payroll.hr_menu_payroll_register"), })
|
|
-
|
|
Then I click on Verify Sheet button.
|
|
-
|
|
!python {model: hr.payroll.register}: |
|
|
self.verify_sheet(cr, uid, [ref("hr_payroll_register_payroll0")], {"lang": "en_US",
|
|
"tz": False, "active_model": "ir.ui.menu", "department_id": False, "active_ids":
|
|
[ref("hr_payroll.hr_menu_payroll_register")], "section_id": False, "active_id":
|
|
ref("hr_payroll.hr_menu_payroll_register"), })
|
|
-
|
|
I check that a state has transferred from 'Wating for Verification' to 'Wating for HR Verification'state
|
|
-
|
|
!python {model: hr.payroll.register}: |
|
|
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)
|