odoo/addons/hr_timesheet/test/test_hr_timesheet.yml

63 lines
2.7 KiB
YAML

-
In order to test hr_timesheet Module in OpenERP, I make "Sign In/Sign Out for Project" to encode and
track time spent on the different projects.
-
Give the access rights of Hr Officer to create employee.
-
!context
uid: 'res_hr_timesheet_officer'
-
I create employee "Gilles Gravie" as "User".
-
!record {model: hr.employee, id: hr.employee_qdp}:
address_home_id: base.res_partner_address_8
name: Gilles Gravie
parent_id: 'hr.employee_al'
user_id: 'base.user_demo'
-
Give the access rights of Employee to Sign In/Sign Out in Project.
-
!context
uid: 'res_hr_timesheet_employee'
-
On "Sign In/Sign Out by Project" wizard i click on "Sign In/Sign Out" button of this wizard.
-
!python {model: hr.sign.in.project}: |
uid = ref('base.user_demo')
state_id = self.check_state(cr, uid, [ref("hr.employee_qdp")], {"active_ids": [ref("hr_timesheet.action_hr_timesheet_sign_in")]})
assert state_id['name'] == 'Sign in / Sign out', "Check the process of sing-in/sing-out."
-
I select start date and Perform start work on project.
-
!python {model: hr.sign.in.project}: |
import time
uid = ref('base.user_demo')
new_id = self.create(cr, uid, {'emp_id': ref('hr.employee_qdp'), 'name': 'Gilles Gravie',
'server_date': time.strftime('%Y-%m-%d %H:%M:%S')})
self.sign_in_result(cr, uid, [new_id], context)
-
I change my project "Thymbra" and I click on the "Change Work" button of this wizard
-
!python {model: hr.sign.out.project}: |
import time
from datetime import datetime, date, timedelta
uid = ref('base.user_demo')
new_id = self.create(cr, uid, {'account_id': ref('account.analytic_nebula'),'analytic_amount': 7.0,
'date': (datetime.now()+timedelta(1)).strftime('%Y-%m-%d %H:%M:%S') ,
'date_start': time.strftime('%Y-%m-%d %H:%M:%S'), 'info': 'Create Yaml for hr module',
'name': 'Gilles Gravie', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'present'})
self.sign_out_result(cr, uid, [new_id], context)
-
My work for this project "Sednacom" is over and I stop working by clicking on "Stop Work" button of this wizard.
-
!python {model: hr.sign.out.project}: |
import time
from datetime import datetime, date, timedelta
uid = ref('base.user_demo')
new_id = self.create(cr, uid, {'account_id': ref('account.analytic_spark'), 'analytic_amount': 7.0,
'date': (datetime.now()+timedelta(2)).strftime('%Y-%m-%d %H:%M:%S'),
'date_start': time.strftime('%Y-%m-%d %H:%M:%S'), 'info': 'Create Yaml for hr module',
'name': 'Gilles Gravie', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'absent'})
self.sign_out_result_end(cr, uid, [new_id], context)