2010-07-29 09:33:52 +00:00
|
|
|
-
|
|
|
|
In order to test hr_timesheet_sheet module in OpenERP, I create timesheet and check validation process done by manager.
|
|
|
|
-
|
2011-11-14 22:31:19 +00:00
|
|
|
I create a new employee "Mark Johnson".
|
2010-05-31 12:29:43 +00:00
|
|
|
-
|
|
|
|
!record {model: hr.employee, id: hr_employee_employee0}:
|
|
|
|
address_home_id: base.res_partner_address_1
|
|
|
|
gender: male
|
2011-07-12 14:57:26 +00:00
|
|
|
marital: single
|
2010-05-31 12:29:43 +00:00
|
|
|
name: Mark Johnson
|
2011-05-03 13:00:24 +00:00
|
|
|
user_id: base.user_demo
|
2010-05-31 12:29:43 +00:00
|
|
|
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
|
|
|
I create new Timesheet journal for employee.
|
|
|
|
-
|
2010-05-31 12:29:43 +00:00
|
|
|
!record {model: account.analytic.journal, id: analytic_journal}:
|
|
|
|
code: TS
|
|
|
|
name: Timesheet Journal
|
|
|
|
type: general
|
2010-07-29 09:33:52 +00:00
|
|
|
|
|
|
|
-
|
|
|
|
I create a new product "Consultancy - Senior Developer".
|
|
|
|
-
|
2010-05-31 12:29:43 +00:00
|
|
|
!record {model: product.product, id: product_consultant}:
|
|
|
|
categ_id: product.product_category_10
|
|
|
|
default_code: DEV
|
|
|
|
list_price: 75.0
|
|
|
|
name: Consultancy - Senior Developer
|
|
|
|
procure_method: make_to_order
|
|
|
|
purchase_ok: False
|
|
|
|
standard_price: 30.0
|
|
|
|
supply_method: produce
|
|
|
|
type: service
|
|
|
|
uom_id: product.uom_hour
|
|
|
|
uom_po_id: product.uom_hour
|
|
|
|
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
|
|
|
I assign this product and journal to "Mark Johnson"
|
|
|
|
-
|
2010-05-31 12:29:43 +00:00
|
|
|
!record {model: hr.employee, id: hr_employee_employee0}:
|
2010-07-29 09:33:52 +00:00
|
|
|
product_id: product_consultant
|
2010-05-31 12:29:43 +00:00
|
|
|
journal_id: analytic_journal
|
2010-07-29 09:33:52 +00:00
|
|
|
|
|
|
|
-
|
|
|
|
I create my current timesheet for "Mark Johnson".
|
2011-05-06 10:27:10 +00:00
|
|
|
-
|
2010-05-31 12:29:43 +00:00
|
|
|
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
|
2011-05-06 10:27:10 +00:00
|
|
|
date_current: !eval time.strftime('%Y-%m-%d')
|
|
|
|
date_from: !eval time.strftime('%Y-%m-01')
|
|
|
|
name: !eval time.strftime('%U')
|
2010-05-31 12:29:43 +00:00
|
|
|
state: new
|
2011-05-03 13:00:24 +00:00
|
|
|
user_id: base.user_demo
|
2010-10-06 18:53:16 +00:00
|
|
|
employee_id: 'hr_employee_employee0'
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
2011-09-23 12:27:33 +00:00
|
|
|
Now, at the time of login, I create Attendances and perform "Sign In" action.
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
2011-09-23 12:27:33 +00:00
|
|
|
!python {model: hr_timesheet_sheet.sheet}:
|
2011-11-08 09:33:29 +00:00
|
|
|
self.sign_in(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {})
|
2011-09-23 12:27:33 +00:00
|
|
|
-
|
|
|
|
I want to check attendance and work of yesterday. I click on <- button.
|
|
|
|
-
|
|
|
|
!python {model: hr_timesheet_sheet.sheet}: |
|
|
|
|
self.date_previous(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], None)
|
|
|
|
-
|
|
|
|
Then I click on "Today" button to fill today's timesheet.
|
|
|
|
-
|
|
|
|
!python {model: hr_timesheet_sheet.sheet}: |
|
|
|
|
self.date_today(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], None)
|
|
|
|
-
|
|
|
|
I want to go to a particular date and see attendance then I select the date and click on "Go to:" button.
|
|
|
|
-
|
|
|
|
!python {model: hr_timesheet_sheet.sheet}: |
|
|
|
|
self.button_dummy(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], None)
|
|
|
|
-
|
|
|
|
I can also move to next day by clicking on -> button.
|
|
|
|
-
|
|
|
|
!python {model: hr_timesheet_sheet.sheet}: |
|
|
|
|
self.date_next(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], None)
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
|
|
|
At the time of logout, I create attendance and perform "Sign Out".
|
|
|
|
-
|
2010-05-31 12:29:43 +00:00
|
|
|
!record {model: hr.attendance, id: hr_attendance_1}:
|
|
|
|
action: sign_out
|
2010-07-29 09:33:52 +00:00
|
|
|
employee_id: 'hr_employee_employee0'
|
2011-07-18 11:03:50 +00:00
|
|
|
name: !eval time.strftime('%Y-%m-%d')+' '+'%s:%s:%s' %(min(23,datetime.now().hour+2),min(59,datetime.now().minute+1),min(59,datetime.now().second+1))
|
2010-05-31 12:29:43 +00:00
|
|
|
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
2010-05-31 12:29:43 +00:00
|
|
|
I create Timesheet Entry for time spend on today work.
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
2010-08-20 11:30:54 +00:00
|
|
|
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
|
2010-07-29 09:33:52 +00:00
|
|
|
timesheet_ids:
|
|
|
|
- account_id: account.analytic_sednacom
|
2011-05-06 10:27:10 +00:00
|
|
|
date: !eval time.strftime('%Y-%m-%d')
|
2010-07-29 09:33:52 +00:00
|
|
|
name: 'Develop yaml for hr module'
|
|
|
|
unit_amount: 3.00
|
|
|
|
amount: -90.00
|
2011-10-18 15:31:52 +00:00
|
|
|
product_id: product_consultant
|
2010-07-29 09:33:52 +00:00
|
|
|
general_account_id: account.a_expense
|
|
|
|
user_id: base.user_root
|
|
|
|
journal_id: hr_timesheet.analytic_journal
|
|
|
|
|
|
|
|
-
|
|
|
|
I confirm my timesheet at end of period by click on "Confirm" button,
|
|
|
|
if the difference between timesheet hour and attendance hour is more than 1 hour it will give message.
|
|
|
|
-
|
|
|
|
!python {model: hr_timesheet_sheet.sheet}: |
|
2010-08-20 11:30:54 +00:00
|
|
|
uid = ref('base.user_root')
|
|
|
|
import netsvc
|
|
|
|
try:
|
|
|
|
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {"lang": 'en_US', "active_ids":
|
|
|
|
[ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form")], "tz": False, "active_model":
|
|
|
|
"ir.ui.menu", "department_id": False, "section_id": False, "search_default_my_timesheet":
|
|
|
|
1, "search_default_user_id": 1, "project_id": False, "active_id": ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form"),
|
|
|
|
})
|
|
|
|
except:
|
|
|
|
pass
|
2010-07-29 09:33:52 +00:00
|
|
|
|
|
|
|
-
|
2010-08-20 11:30:54 +00:00
|
|
|
I Modified the timesheet record and make the difference less than 1 hour.
|
2010-05-31 12:29:43 +00:00
|
|
|
-
|
2010-08-20 11:30:54 +00:00
|
|
|
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
|
2010-05-31 12:29:43 +00:00
|
|
|
timesheet_ids:
|
|
|
|
- account_id: account.analytic_sednacom
|
2011-05-06 10:27:10 +00:00
|
|
|
date: !eval time.strftime('%Y-%m-%d')
|
2010-05-31 12:29:43 +00:00
|
|
|
name: 'Develop yaml for hr module'
|
2010-07-29 09:33:52 +00:00
|
|
|
unit_amount: 2.0
|
2010-05-31 12:29:43 +00:00
|
|
|
amount: -90.00
|
2011-10-18 15:31:52 +00:00
|
|
|
product_id: product_consultant
|
2010-05-31 12:29:43 +00:00
|
|
|
general_account_id: account.a_expense
|
2010-07-29 09:33:52 +00:00
|
|
|
user_id: base.user_root
|
|
|
|
journal_id: hr_timesheet.analytic_journal
|
2010-05-31 12:29:43 +00:00
|
|
|
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
|
|
|
I tried again to confirm the timesheet after modification.
|
|
|
|
-
|
2010-05-31 12:29:43 +00:00
|
|
|
!python {model: hr_timesheet_sheet.sheet}: |
|
2010-07-29 09:33:52 +00:00
|
|
|
uid = ref('base.user_root')
|
|
|
|
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {"lang": 'en_US', "active_ids":
|
|
|
|
[ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form")], "tz": False, "active_model":
|
|
|
|
"ir.ui.menu", "department_id": False, "section_id": False, "search_default_my_timesheet":
|
|
|
|
1, "search_default_user_id": 1, "project_id": False, "active_id": ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form"),
|
|
|
|
})
|
2010-06-14 07:55:56 +00:00
|
|
|
|
2010-07-29 09:33:52 +00:00
|
|
|
-
|
|
|
|
This time timesheet confirmed successfully.
|
|
|
|
I check that state is "Confirmed".
|
|
|
|
-
|
|
|
|
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
|
|
|
|
- state == 'confirm'
|
|
|
|
-
|
|
|
|
The manager will accept This request by click on "Accept" button.
|
2010-06-14 07:55:56 +00:00
|
|
|
|
2010-05-31 12:29:43 +00:00
|
|
|
-
|
2010-07-29 09:33:52 +00:00
|
|
|
!python {model: hr_timesheet_sheet.sheet}: |
|
|
|
|
self.write(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {'state': 'done'})
|
|
|
|
-
|
|
|
|
I check that state is "Done".
|
|
|
|
-
|
|
|
|
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
|
|
|
|
- state == 'done'
|
|
|
|
|