2 I test the 'Payment Advice' in order to check the hr_payroll in OpenERP
4 I create a new employee “Richie”
6 !record {model: hr.employee, id: hr_employee_richie0}:
7 address_home_id: base.res_partner_address_1
8 address_id: base.res_partner_address_9
12 - advantages_gross: 0.0
14 date_end: !eval "'%s-%s-%s' %(datetime.now().year+1,datetime.now().month,datetime.now().day)"
15 date_start: !eval time.strftime('%Y-%m-%d')
18 wage_type_id: hr_contract.hr_contract_monthly_gross
19 type_id: hr_contract.hr_contract_type_emp
21 department_id: hr.dep_it
23 marital: hr.hr_employee_marital_status_single
27 I create a new payment advice record
29 !record {model: hr.payroll.advice, id: hr_payroll_advice_advice0}:
33 employee_id: 'hr_employee_richie0'
38 I confirmed the sheet by click on "Confirm Sheet" button.
40 !python {model: hr.payroll.advice}: |
41 self.confirm_sheet(cr, uid, [ref("hr_payroll_advice_advice0")], {"lang": "en_US",
42 "active_model": "ir.ui.menu", "active_ids": [ref("hr_payroll.hr_menu_payment_advice")],
43 "tz": False, "active_id": ref("hr_payroll.hr_menu_payment_advice")})
45 I check that a state is "Confirm"
47 !python {model: hr.payroll.advice}: |
48 from tools.translate import _
49 advice_id=self.browse(cr, uid, ref("hr_payroll_advice_advice0"))
50 assert(advice_id.state == 'confirm'), _('State not changed!')
55 !python {model: hr.payroll.advice}: |
56 import netsvc, tools, os
57 (data, format) = netsvc.LocalService('report.payroll.advice').create(cr, uid, [ref('hr_payroll_advice_advice0')], {}, {})
58 if tools.config['test_report_directory']:
59 file(os.path.join(tools.config['test_report_directory'], 'hr_payroll-payroll-advice.'+format), 'wb+').write(data)