2 In order to test hr_timesheet Module in OpenERP, I make "Sign In/Sign Out for Project" to encode and
3 track time spent on the different projects.
6 I create a new employee “Mark Johnson” to test Timesheet.
8 !record {model: hr.employee, id: hr_employee_employee0}:
9 address_home_id: base.res_partner_address_1
10 company_id: base.main_company
12 marital: hr.hr_employee_marital_status_single
14 user_id: base.user_root
17 I create new user "test_timesheet_user1".
19 !record {model: res.users, id: test_timesheet_user1}:
20 company_id: base.main_company
26 - base.group_hr_manager
27 login: test_timesheet_user1
28 name: test_timesheet_user1
29 password: test_timesheet_user1
32 I create another new employee "Francline" as "test_timesheet_user1".
34 !record {model: hr.employee, id: hr_employee_fracline1}:
35 address_home_id: base.res_partner_address_8
37 parent_id: 'hr_employee_employee0'
38 user_id: 'test_timesheet_user1'
41 I create Timesheet journal for employee.
43 !record {model: account.analytic.journal, id: analytic_journal}:
45 name: Timesheet Journal
49 I create a product as "Consultancy - Senior Developer".
51 !record {model: product.product, id: product_consultant}:
52 categ_id: product.product_category_10
55 name: Consultancy - Senior Developer
56 procure_method: make_to_order
59 supply_method: produce
61 uom_id: product.uom_hour
62 uom_po_id: product.uom_hour
65 I assigned product and journal to "Mark Johnson"
67 !record {model: hr.employee, id: hr_employee_employee0}:
68 product_id: product_consultant
69 journal_id: analytic_journal
71 I assigned product and journal to "Francline".
73 !record {model: hr.employee, id: hr_employee_fracline1}:
74 product_id: product_consultant
75 journal_id: analytic_journal
77 I create attendance and perform "Sign In" action with proper reason.
79 !record {model: hr.attendance, id: hr_attendance_0}:
81 employee_id: 'hr_employee_fracline1'
82 name: !eval time.strftime('%Y-%m-%d 10:00:00')
85 I create attendance and perform "Sign Out" action.
87 !record {model: hr.attendance, id: hr_attendance_1}:
89 employee_id: 'hr_employee_fracline1'
90 name: !eval time.strftime('%Y-%m-%d 11:00:00')
93 On "Sign In/Sign Out by Project" wizard I click on "Sign In/Sign Out" button of this wizard.
95 !python {model: hr.sign.in.project}: |
96 uid = ref('test_timesheet_user1')
97 self.check_state(cr, uid, [ref("hr_employee_fracline1")], {"active_ids": [ref("hr_timesheet.action_hr_timesheet_sign_in")]})
99 I select start date and Perform start work on project.
101 !python {model: hr.sign.in.project}: |
103 uid = ref('test_timesheet_user1'),
104 new_id = self.create(cr, uid, {'emp_id': ref('hr_employee_fracline1'), 'name': 'Francline', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'date': time.strftime('%Y-%m-%d 12:%M:%S'), 'state': 'absent'})
105 self.sign_in_result(cr, uid, [new_id], context)
108 To stop work I click on "Sign In/Sign Out" button of "Sign In/Sign Out by Project" wizard.
109 Which check state in hr attendace form for user.
111 !python {model: hr.sign.in.project}: |
112 uid = ref('test_timesheet_user1')
113 ids = self.search(cr, uid, [('emp_id', '=', ref('hr_employee_fracline1')),('name', '=', 'Francline')])
114 self.check_state(cr, uid, ids, {"active_ids": [ref("hr_timesheet.action_hr_timesheet_sign_in")]
118 I Create an analytic account "Project2".
120 !record {model: account.analytic.account, id: account_analytic_account_project0}:
121 company_id: base.main_company
123 parent_id: account.analytic_root
128 My work for this project is over and I stop working by clicking on "Stop Work" button of this wizard.
130 !python {model: hr.sign.out.project}: |
132 from datetime import datetime, date, timedelta
133 uid = ref('test_timesheet_user1')
134 new_id = self.create(cr, uid, {'account_id': ref('account_analytic_account_project0'), 'analytic_amount': 6.0, 'date': time.strftime('%Y-%m-%d 18:%M:%S'), 'date_start': time.strftime('%Y-%m-%d %H:%M:%S'), 'info': 'Create Yaml for hr module', 'name': 'Francline', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'absent'})
135 self.sign_out_result_end(cr, uid, [new_id], context)
138 I can see employee timesheet for particular month using "Employee Timesheet" report.