From 2719744ae9cf2281fe469499dc6751f7ad1b458d Mon Sep 17 00:00:00 2001 From: "Ujjvala Collins (OpenERP)" Date: Thu, 22 Sep 2011 18:22:50 +0530 Subject: [PATCH] [IMP] hr_payroll_account: Improved yaml. bzr revid: uco@tinyerp.com-20110922125250-i3xur3jinsstg0g7 --- .../test/hr_payroll_account.yml | 44 +++++++++++++------ 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/addons/hr_payroll_account/test/hr_payroll_account.yml b/addons/hr_payroll_account/test/hr_payroll_account.yml index c399789f439..778eeb14bf5 100644 --- a/addons/hr_payroll_account/test/hr_payroll_account.yml +++ b/addons/hr_payroll_account/test/hr_payroll_account.yml @@ -1,7 +1,7 @@ - - I test the "Payslip" in order to check the hr_payroll_account module in OpenERP + I test the "Payslip" in order to check the hr_payroll_account module in OpenERP. - - I create a bank record + I create a bank record. - !record {model: res.partner.bank, id: res_partner_bank_0}: acc_number: '001-9876543-21' @@ -9,7 +9,7 @@ state: bank bank: base.res_bank_1 - - I create a new employee "John" + I create a new employee "John". - !record {model: hr.employee, id: hr_employee_john}: address_home_id: base.res_partner_address_2 @@ -24,7 +24,7 @@ bank_account_id: res_partner_bank_0 vehicle_distance: 0.0 - - I create a salary structure for 'Software Developer' + I create a salary structure for 'Software Developer'. - !record {model: hr.payroll.structure, id: hr_payroll_structure_softwaredeveloper}: name: Salary Structure for Software Developer @@ -39,7 +39,7 @@ - hr_payroll.hr_salary_rule_meal_voucher - hr_payroll.hr_salary_rule_sales_commission - - I create a contract for "John" + I create a contract for "John". - !record {model: hr.contract, id: hr_contract_john}: date_end: !eval "'%s-%s-%s' %(datetime.now().year+1,datetime.now().month,datetime.now().day)" @@ -51,13 +51,22 @@ struct_id: hr_payroll_structure_softwaredeveloper working_hours: resource.timesheet_group1 - - I create a Payslip + I create a Payslip. - !record {model: hr.payslip, id: hr_payslip_0}: employee_id: hr_employee_john journal_id: account.expenses_journal - - The selection of an employee fills the contract, structure, worked days and input data fields + I assign contract in the payslip. +- + !python {model: hr.payslip}: | + import time + from datetime import datetime + date_from = '%s-%s-%s' %(datetime.now().year+1,datetime.now().month,datetime.now().day) + date_to = time.strftime('%Y-%m-%d') + self.onchange_contract_id(cr, uid, [ref('hr_payslip_0')], date_from, date_to, ref('hr_employee_john'), ref('hr_contract_john'), None) +- + The selection of an employee fills the contract, structure, worked days and input data fields. - !python {model: hr.payslip}: | import time @@ -76,20 +85,20 @@ vals['input_line_ids'] = [(0,0,i) for i in res['value']['input_line_ids']] self.write(cr, uid, ref("hr_payslip_0"), vals) - - I assign the amount to Input data + I assign the amount to Input data. - !python {model: hr.payslip.input}: | ids = self.search(cr, uid, [('payslip_id', '=', ref("hr_payslip_0"))]) self.write(cr, uid, ids, {'amount': 5.0}) - - I verify the payslip is in draft state + I verify the payslip is in draft state. - !python {model: hr.payslip}: | from tools.translate import _ payslip_brw=self.browse(cr, uid, ref("hr_payslip_0")) assert(payslip_brw.state == 'draft'), _('State not changed!') - - I click on "Compute Sheet" button + I click on "Compute Sheet" button. - !python {model: hr.payslip}: | self.compute_sheet(cr, uid, [ref("hr_payslip_0")], {"lang": "en_US", "tz": False, @@ -97,19 +106,28 @@ "section_id": False, "active_id": ref("hr_payroll.menu_department_tree"), }) - - Then I click on the "Confirm" button + I want to check cancel button. So I first cancel the sheet then make it set to draft. +- + !python {model: hr.payslip}: | + import netsvc + wf_service = netsvc.LocalService("workflow") + self.cancel_sheet(cr, uid, [ref("hr_payslip_0")], None) + wf_service.trg_validate(uid, 'hr.payslip', ref("hr_payslip_0"), 'draft', cr) +- + Then I click on the "Confirm" button. - !workflow {model: hr.payslip, action: hr_verify_sheet, ref: hr_payslip_0} - - I verify that the Accounting Entries are created + I verify that the Accounting Entries are created. - !python {model: hr.payslip}: | payslip = self.browse(cr, uid, ref("hr_payslip_0")) assert payslip.move_id, "Accounting Entries has not been created" - - I verify that the payslip is in done state + I verify that the payslip is in done state. - !python {model: hr.payslip}: | from tools.translate import _ payslip_brw=self.browse(cr, uid, ref("hr_payslip_0")) assert(payslip_brw.state == 'done'), _('State not changed!') +