From f78d458ca46231cc1cf35fca57550a6018709b29 Mon Sep 17 00:00:00 2001 From: "atp (Open ERP)" Date: Mon, 14 Jun 2010 10:48:24 +0530 Subject: [PATCH] [IMP]: hr_timesheet: Improvement in yml file for hr_timesheet module. bzr revid: atp@tinyerp.co.in-20100614051824-np9mkacac875i5dw --- .../hr_timesheet/test/test_hr_timesheet.yml | 149 ++++++++++++------ 1 file changed, 105 insertions(+), 44 deletions(-) diff --git a/addons/hr_timesheet/test/test_hr_timesheet.yml b/addons/hr_timesheet/test/test_hr_timesheet.yml index 69079149f03..01ca976e3ff 100644 --- a/addons/hr_timesheet/test/test_hr_timesheet.yml +++ b/addons/hr_timesheet/test/test_hr_timesheet.yml @@ -4,7 +4,6 @@ - | Now, I create a new employee “Mark Johnson” to test Timesheet. - - !record {model: hr.employee, id: hr_employee_employee0}: address_home_id: base.res_partner_address_1 @@ -13,40 +12,42 @@ marital: hr.hr_employee_marital_status_single name: Mark Johnson user_id: base.user_root - + - | - I start by "Sign In/Sign Out by Project" wizard and click on "Sign In/Sign Out" button of this wizard. -- - !python {model: hr.sign.in.project}: | - self.check_state(cr, uid, [ref("hr_employee_employee0")]) -- | - I select start date and Perform start work on project. -- - !record {model: hr.sign.in.project, id: hr_employee_employee0}: - name: employee1 - server_date: '2010-05-20 16:10:59' - state: absent -- | - I click on "Start Working" button of this wizard to start work on Project. + I create new user "user1" which is assigned to employee. - - !python {model: hr.sign.in.project}: | - self.sign_in_result(cr, uid, [ref("hr_employee_employee0")], context) -- | - My work is done and I want to stop work.for that I click on "Sign In/Sign Out" button of "Sign In/Sign Out by Project" wizard. - Which check state in hr attendace form for user. -- - !python {model: hr.sign.in.project}: | - obj_attendance = self.pool.get('hr.employee') - emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "employee1")]) - if emp_id: - employee = obj_attendance.read(cr, uid, emp_id)[0] - self.write(cr, uid, [ref('hr_employee_employee0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]}) - self.check_state(cr, uid, [ref("hr_employee_employee0")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")] - }) + !record {model: res.users, id: res_users_user0}: + company_id: base.main_company + context_lang: en_US + groups_id: + - hr.group_hr_user + - hr_attendance.group_hr_attendance + - base.group_user + - base.group_extended + - hr.group_hr_manager + login: user1 + name: user1 + password: user1 +- | + I create another employee "Francline" as "user1". +- + !record {model: hr.employee, id: hr_employee_fracline1}: + address_home_id: base.res_partner_address_8 + name: Francline + parent_id: 'hr_employee_employee0' + user_id: 'res_users_user0' + +- | + Given that I have Timesheet journal for employee. +- + !record {model: account.analytic.journal, id: analytic_journal}: + code: TS + name: Timesheet Journal + type: general + - | Given that I have product for "Consultancy - Senior Developer". - - !record {model: product.product, id: product_consultant}: categ_id: product.product_category_10 @@ -65,32 +66,92 @@ I assing product and journal to "Mark Johnson" - !record {model: hr.employee, id: hr_employee_employee0}: + product_id: product_consultant journal_id: analytic_journal - product_id: product_consultant - +- | + And also assing product and journal to "francline" employee. +- + !record {model: hr.employee, id: hr_employee_fracline1}: + product_id: product_consultant + journal_id: analytic_journal +- | + Now , When I came in office , I create Attendances and perform "Sign In" action with proper reason. +- + !record {model: hr.attendance, id: hr_attendance_0}: + action: sign_in + employee_id: 'hr_employee_fracline1' + name: '2010-05-26 10:08:08' + +- | + When I left office , I create attendance and perform "Sign Out". +- + !record {model: hr.attendance, id: hr_attendance_1}: + action: sign_out + employee_id: 'hr_employee_fracline1' + name: '2010-05-26 15:10:55' + + +- | + I start by "Sign In/Sign Out by Project" wizard and click on "Sign In/Sign Out" button of this wizard. +- + !python {model: hr.sign.in.project}: | + uid = ref('res_users_user0') + self.check_state(cr, uid, [ref("hr_employee_fracline1")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")]}) +- | + I select start date and Perform start work on project. +- + !record {model: hr.sign.in.project, id: hr_sign_in_project_francline0}: + emp_id: 'hr_employee_fracline1' + name: Francline + server_date: '2010-06-08 19:50:54' + state: absent + + +- | + I click on "Start Working" button of this wizard to start work on Project. +- + !python {model: hr.sign.in.project}: | + uid = ref('res_users_user0') + obj_attendance = self.pool.get('hr.employee') + emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Francline")]) + if emp_id: + employee = obj_attendance.read(cr, uid, emp_id)[0] + self.write(cr, uid, [ref('hr_sign_in_project_francline0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]}) + self.sign_in_result(cr, uid, [ref("hr_sign_in_project_francline0")], context) + +- | + My work is done and I want to stop work.for that I click on "Sign In/Sign Out" button of "Sign In/Sign Out by Project" wizard. + Which check state in hr attendace form for user. +- + !python {model: hr.sign.in.project}: | + uid = ref('res_users_user0') + self.check_state(cr, uid, [ref("hr_sign_in_project_francline0")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")] + }) + - | This will Open "hr sign out project" form. I select analytical project2 development account. - - !record {model: hr.sign.out.project, id: hr_employee_employee0}: + !record {model: hr.sign.out.project, id: hr_sign_out_project_francline0}: account_id: account.analytic_project_2_development analytic_amount: 7.0 - date: '2010-05-21 16:40:00' - date_start: '2010-05-19 16:37:00' + date: '2010-05-25 16:40:00' + date_start: '2010-06-05 16:37:00' info: Create Yaml for hr module - name: Mark Johnson - server_date: '2010-05-19 16:40:15' + name: Francline + server_date: '2010-06-09 16:40:15' state: present - | My work for this project is over and I stop work by click on "Stop Work" button of this wizard. - !python {model: hr.sign.out.project}: | - emp_obj = self.pool.get('hr.employee') - emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid), ('name', '=', 'employee1')]) - if emp_id: - employee = emp_obj.read(cr, uid, emp_id)[0] - self.write(cr, uid, [ref('hr_employee_employee0')], {'emp_id': emp_id[0] }) - #self.sign_out_result(cr, uid, [ref('hr_employee_employee0')]) + uid = ref('res_users_user0') + obj_attendance = self.pool.get('hr.employee') + emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Francline")]) + if emp_id: + employee = obj_attendance.read(cr, uid, emp_id)[0] + self.write(cr, uid, [ref('hr_sign_out_project_francline0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]}) + #self.sign_out_result_end(cr, uid, [ref('hr_sign_out_project_francline0')]) - | - I can see employee timesheet for particular month using "Employee Timesheet" report. \ No newline at end of file + I can see employee timesheet for particular month using "Employee Timesheet" report.