odoo/addons/hr_payroll/test/payment_advice.yml

60 lines
2.1 KiB
YAML

-
I test the 'Payment Advice' in order to check the hr_payroll in OpenERP
-
I create a new employee “Richie”
-
!record {model: hr.employee, id: hr_employee_richie0}:
address_home_id: base.res_partner_address_1
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: Richie
vehicle_distance: 0.0
-
I create a new payment advice record
-
!record {model: hr.payroll.advice, id: hr_payroll_advice_advice0}:
line_ids:
- amount: 5500.0
bysal: 5000.0
employee_id: 'hr_employee_richie0'
flag: C
name: Axis Bank
name: advice1
-
I confirmed the sheet by click on "Confirm Sheet" button.
-
!python {model: hr.payroll.advice}: |
self.confirm_sheet(cr, uid, [ref("hr_payroll_advice_advice0")], {"lang": "en_US",
"active_model": "ir.ui.menu", "active_ids": [ref("hr_payroll.hr_menu_payment_advice")],
"tz": False, "active_id": ref("hr_payroll.hr_menu_payment_advice")})
-
I check that a state is "Confirm"
-
!python {model: hr.payroll.advice}: |
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)