[IMP] Improvement in YML
bzr revid: hpa@tinyerp.com-20111220065042-m4ebxsy2tl04yzf1
This commit is contained in:
parent
540134eff2
commit
98cf8b318c
|
@ -56,8 +56,10 @@ to set up a management by affair.
|
|||
'hr_timesheet_installer.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_demo.xml'],
|
||||
'test': ['test/test_hr_timesheet.yml',
|
||||
'test': [
|
||||
'test/test_hr_timesheet.yml',
|
||||
'test/hr_timesheet_report.yml',
|
||||
'test/hr_timesheet_demo.yml',
|
||||
],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
-
|
||||
!record {model: hr.analytic.timesheet, id: working_hours_coding, view: False}:
|
||||
user_id: base.user_demo
|
||||
date: !eval time.strftime('%Y-%m-%d')
|
||||
account_id: account.analytic_administratif
|
||||
unit_amount: 1.0
|
|
@ -14,50 +14,38 @@
|
|||
-
|
||||
!python {model: hr.sign.in.project}: |
|
||||
uid = ref('base.user_demo')
|
||||
self.check_state(cr, uid, [ref("hr.employee2")], {"active_ids": [ref("hr_timesheet.action_hr_timesheet_sign_in")]})
|
||||
state_id = self.check_state(cr, uid, [ref("hr.employee2")], {"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.employee2'), 'name': 'Quentin Paolino', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'absent'})
|
||||
self.sign_in_result(cr, uid, [new_id], context)
|
||||
import time
|
||||
uid = ref('base.user_demo')
|
||||
new_id = self.create(cr, uid, {'emp_id': ref('hr.employee2'), 'name': 'Quentin Paolino',
|
||||
'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'present'})
|
||||
self.sign_in_result(cr, uid, [new_id], context)
|
||||
-
|
||||
I create a timesheet line manually to check several default values.
|
||||
I also assign proper date and user for that line.
|
||||
-
|
||||
!python {model: hr.analytic.timesheet}: |
|
||||
import time
|
||||
uid = ref('base.user_demo')
|
||||
current_date = time.strftime('%Y-%m-%d')
|
||||
vals = {'name': 'Worked on project',
|
||||
'user_id': ref('base.user_demo'),
|
||||
'account_id': ref('account.analytic_project_1_development'),
|
||||
'unit_amount': 5.00,
|
||||
'journal_id': ref('analytic_journal')
|
||||
}
|
||||
line_id = self.create(cr, uid, vals, None)
|
||||
res = self.on_change_date(cr, uid, [line_id], current_date)
|
||||
values = dict([('date', current_date)] + res['value'].items())
|
||||
res1 = self.on_change_user_id(cr, uid, [line_id], ref('base.user_root'))
|
||||
values.update(dict([('user_id', ref('base.user_root'))] + res1['value'].items()))
|
||||
self.write(cr, uid, [line_id], values, None)
|
||||
-
|
||||
To stop work 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('base.user_demo')
|
||||
ids = self.search(cr, uid, [('emp_id', '=', ref('hr.employee2')),('name', '=', 'Quentin Paolino')])
|
||||
self.check_state(cr, uid, ids, {"active_ids": [ref("hr_timesheet.action_hr_timesheet_sign_in")]
|
||||
})
|
||||
-
|
||||
My work for this project 1 is over and I stop working by clicking on "Stop Work" button of this wizard.
|
||||
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_project_1'), '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': 'Francline', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'absent'})
|
||||
self.sign_out_result_end(cr, uid, [new_id], context)
|
||||
import time
|
||||
from datetime import datetime, date, timedelta
|
||||
uid = ref('base.user_demo')
|
||||
new_id = self.create(cr, uid, {'account_id': ref('account.analytic_thymbra'),'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': 'Quentin Paolino', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'action'})
|
||||
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_sednacom'), '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': 'Quentin Paolino', 'server_date': time.strftime('%Y-%m-%d %H:%M:%S'), 'state': 'absent'})
|
||||
self.sign_out_result_end(cr, uid, [new_id], context)
|
|
@ -88,6 +88,7 @@ class hr_so_project(osv.osv_memory):
|
|||
return timesheet_obj.create(cr, uid, res, context=context)
|
||||
|
||||
def sign_out_result_end(self, cr, uid, ids, context=None):
|
||||
print""
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
for data in self.browse(cr, uid, ids, context=context):
|
||||
emp_id = data.emp_id.id
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
In order to test hr_timesheet_sheet module in OpenERP,
|
||||
I create Timesheet and check validation process done by manager.
|
||||
-
|
||||
I assign this product and journal to employee "Quentin Paolino"
|
||||
I assign this product(Service on Timesheet) and journal(Timesheet Journal) to employee "Quentin Paolino"
|
||||
-
|
||||
!record {model: hr.employee, id: hr.employee2}:
|
||||
product_id: product.product_consultant
|
||||
|
@ -13,35 +13,42 @@
|
|||
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
|
||||
date_current: !eval time.strftime('%Y-%m-%d')
|
||||
date_from: !eval time.strftime('%Y-%m-01')
|
||||
name: !eval time.strftime('%U')
|
||||
name: Quentin Paolinon
|
||||
state: new
|
||||
user_id: base.user_demo
|
||||
employee_id: 'hr.employee2'
|
||||
-
|
||||
Now, at the time of login, I create Attendances and perform "Sign In" action.
|
||||
-
|
||||
!python {model: hr_timesheet_sheet.sheet}:
|
||||
!python {model: hr_timesheet_sheet.sheet}: |
|
||||
self.sign_in(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {})
|
||||
task_work = self.search(cr, uid, [("name","=","Quentin Paolinon")],context)[0]
|
||||
task_ids = self.browse(cr, uid, task_work, context)
|
||||
assert task_ids.state == "draft", "I State In Timesheet"
|
||||
-
|
||||
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)
|
||||
date_prev = self.date_previous(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], None)
|
||||
assert date_prev == True, "I See Previous Date Timesheet"
|
||||
-
|
||||
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)
|
||||
date_to = self.date_today(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], None)
|
||||
assert date_to == True, "I See Today Date Timesheet"
|
||||
-
|
||||
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)
|
||||
date_next = self.date_next(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], None)
|
||||
assert date_next == True, "I See Next Date Timesheet"
|
||||
-
|
||||
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)
|
||||
button_dumy = self.button_dummy(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], None)
|
||||
assert button_dumy == True, "I See Particular Date Attendance"
|
||||
-
|
||||
At the time of logout, I create attendance and perform "Sign Out".
|
||||
-
|
||||
|
@ -106,7 +113,6 @@
|
|||
- state == 'confirm'
|
||||
-
|
||||
The manager will accept This request by click on "Accept" button.
|
||||
|
||||
-
|
||||
!python {model: hr_timesheet_sheet.sheet}: |
|
||||
self.write(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {'state': 'done'})
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
-
|
||||
I set work entry for employee
|
||||
I set task work entry for Employee
|
||||
-
|
||||
!record {model: project.task.work, id: project_task_work1}:
|
||||
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
@ -9,24 +9,13 @@
|
|||
user_id: project.res_users_analyst
|
||||
company_id: base.main_company
|
||||
-
|
||||
I set timesheet line for employee in current timesheet
|
||||
I check Timesheet line for employee in current Timesheet
|
||||
-
|
||||
!python {model: hr.analytic.timesheet}: |
|
||||
import datetime
|
||||
uid = ref('project.res_users_analyst')
|
||||
current_date = (datetime.date.today().strftime('%Y-%m-%d'))
|
||||
vals = {'name': 'Test Timesheet records',
|
||||
'user_id': ref('project.res_users_analyst'),
|
||||
'account_id': ref('account.analytic_project_1_development'),
|
||||
'unit_amount': 5.00,
|
||||
'journal_id': ref('hr_timesheet.analytic_journal')
|
||||
}
|
||||
line_id = self.create(cr, uid, vals, None)
|
||||
res = self.on_change_date(cr, uid, [line_id], current_date)
|
||||
values = dict([('date', current_date)] + res['value'].items())
|
||||
res1 = self.on_change_user_id(cr, uid, [line_id], ref('project.res_users_analyst'))
|
||||
values.update(dict([('user_id', ref('project.res_users_analyst'))] + res1['value'].items()))
|
||||
self.write(cr, uid, [line_id], values, None)
|
||||
|
||||
|
||||
|
||||
import datetime
|
||||
start = (datetime.date.today().strftime('%Y-%m-%d'))
|
||||
task_work = self.search(cr, uid, [("name","=","Prepare Requirements Document: Test Timesheet records")],context)[0]
|
||||
task_ids = self.browse(cr, uid, task_work, context)
|
||||
assert task_ids.user_id.id == ref("project.res_users_analyst"), 'Error, The User in Timesheet is not Correct'
|
||||
assert task_ids.date == start, 'Error, The Date in Timesheet is not ok'
|
||||
assert task_ids.product_uom_id.name == "Hour", 'Error, The Hour in Timesheet is not ok'
|
|
@ -9,7 +9,6 @@
|
|||
password: hr
|
||||
groups_id:
|
||||
- base.group_hr_manager
|
||||
|
||||
-
|
||||
Create a product with type service used to specify employees designation
|
||||
-
|
||||
|
@ -28,7 +27,6 @@
|
|||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
|
||||
-
|
||||
Create an analytic journal for employees timesheet
|
||||
-
|
||||
|
@ -36,7 +34,6 @@
|
|||
company_id: base.main_company
|
||||
name: HR Timesheet
|
||||
type: general
|
||||
|
||||
-
|
||||
Create an employee 'HR Manager' for user 'HR Manager'
|
||||
-
|
||||
|
@ -45,7 +42,6 @@
|
|||
user_id: res_users_hrmanager0
|
||||
product_id: product_product_hrmanger0
|
||||
journal_id: account_analytic_journal_hrtimesheet0
|
||||
|
||||
-
|
||||
Create a timesheet sheet for HR manager
|
||||
-
|
||||
|
@ -57,15 +53,12 @@
|
|||
state: new
|
||||
user_id: res_users_hrmanager0
|
||||
employee_id : 'hr_employee_hrmanager0'
|
||||
|
||||
-
|
||||
Create a project 'Timesheet Management'
|
||||
-
|
||||
!record {model: project.project, id: project_project_timesheetmanagement0}:
|
||||
company_id: base.main_company
|
||||
name: Timesheet Management
|
||||
|
||||
|
||||
-
|
||||
Create a task 'Get all timesheet records'
|
||||
-
|
||||
|
@ -77,7 +70,6 @@
|
|||
remaining_hours: 20.0
|
||||
state: draft
|
||||
user_id: res_users_hrmanager0
|
||||
|
||||
-
|
||||
Open the task
|
||||
-
|
||||
|
@ -86,7 +78,6 @@
|
|||
"en_US", "active_ids": [ref("project_project_timesheetmanagement0")], "tz":
|
||||
False, "active_model": "project.project", "department_id": False, "project_id":
|
||||
False, "active_id": ref("project_project_timesheetmanagement0"), })
|
||||
|
||||
-
|
||||
Make a work task entry 'Get work calendar of all employees' of 10 hours done by HR manager
|
||||
-
|
||||
|
@ -96,9 +87,8 @@
|
|||
hours: 10.0
|
||||
name: Get work calendar of all employees
|
||||
user_id: res_users_hrmanager0
|
||||
|
||||
-
|
||||
Check for timesheet_ids in HR manager's timesheet
|
||||
-
|
||||
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_sheetforhrmanager0, string: After hr manager's work task, length of timesheet line of current timesheet must be greater then 1}:
|
||||
- len(timesheet_ids) > 0
|
||||
- len(timesheet_ids) > 0
|
Loading…
Reference in New Issue