2
In order to test hr_timesheet Module in OpenERP, I make "Sign In or Sign Out for Project" to encode and
3
track time spent on the different projects.
6
Now, I create a new employee “Mark Johnson” to test Timesheet.
9
!record {model: hr.employee, id: hr_employee_employee0}:
10
address_home_id: base.res_partner_address_1
11
company_id: base.main_company
13
marital: hr.hr_employee_marital_status_single
15
user_id: base.user_root
18
I start by "Sign In/Sign Out by Project" wizard and click on "Sign In/Sign Out" button of this wizard.
20
!python {model: hr.sign.in.project}: |
21
self.check_state(cr, uid, [ref("hr_employee_employee0")])
23
I select start date and Perform start work on project.
25
!record {model: hr.sign.in.project, id: hr_employee_employee0}:
27
server_date: '2010-05-20 16:10:59'
30
I click on "Start Working" button of this wizard to start work on Project.
32
!python {model: hr.sign.in.project}: |
33
self.sign_in_result(cr, uid, [ref("hr_employee_employee0")], context)
35
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.
36
Which check state in hr attendace form for user.
38
!python {model: hr.sign.in.project}: |
39
obj_attendance = self.pool.get('hr.employee')
40
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "employee1")])
42
employee = obj_attendance.read(cr, uid, emp_id)[0]
43
self.write(cr, uid, [ref('hr_employee_employee0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
44
self.check_state(cr, uid, [ref("hr_employee_employee0")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")]
48
Given that I have product for "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
66
I assing product and journal to "Mark Johnson"
68
!record {model: hr.employee, id: hr_employee_employee0}:
69
journal_id: analytic_journal
70
product_id: product_consultant
73
This will Open "hr sign out project" form. I select analytical project2 development account.
75
!record {model: hr.sign.out.project, id: hr_employee_employee0}:
76
account_id: account.analytic_project_2_development
78
date: '2010-05-21 16:40:00'
79
date_start: '2010-05-19 16:37:00'
80
info: Create Yaml for hr module
82
server_date: '2010-05-19 16:40:15'
86
My work for this project is over and I stop work by click on "Stop Work" button of this wizard.
88
!python {model: hr.sign.out.project}: |
89
emp_obj = self.pool.get('hr.employee')
90
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid), ('name', '=', 'employee1')])
92
employee = emp_obj.read(cr, uid, emp_id)[0]
93
self.write(cr, uid, [ref('hr_employee_employee0')], {'emp_id': emp_id[0] })
94
#self.sign_out_result(cr, uid, [ref('hr_employee_employee0')])
97
I can see employee timesheet for particular month using "Employee Timesheet" report.
b'\\ No newline at end of file'