[MERGE] atp branch for yaml hr modules (has some problems will be solved)

bzr revid: mra@mra-laptop-20100610092802-bgs4ula327mt6ydc
This commit is contained in:
Mustufa Rangwala 2010-06-10 14:58:02 +05:30
commit c9e2f6a493
17 changed files with 661 additions and 64 deletions

View File

@ -1,15 +1,15 @@
- |
In order to test the hr module in OpenERP, I will create new Employee , Department and Job Position.
In order to test hr module in OpenERP, I will create new Employee , Department and Job Position.
-
|
First I create Department "R & D" in Department form.
I create "R & D" Department in Department form.
-
!record {model: hr.department, id: hr_department_rd0}:
manager_id: base.user_root
name: 'R & D '
-
|
Now, I create a new employee “employee1”.
Now, I create a new employee “Mark Johnson”.
select "R & D" Department which I had created.
-
!record {model: hr.employee, id: hr_employee_employee0}:
@ -22,7 +22,7 @@
department_id: 'hr_department_rd0'
- |
In order to check the wizard “Employee Hierarchy” I will create new employee “employee2” and select "employee1" as
In order to check the wizard “Employee Hierarchy” , I will create new employee “Phil Graves ” and select "Mark Johnson" as
Manager.
-
!record {model: hr.employee, id: hr_employee_employee1}:
@ -33,11 +33,11 @@
user_id: base.user_demo
parent_id: 'hr_employee_employee0'
- |
Now I will open up form view of “employee1” and test the wizard “Employee Hierarchy” so it display the employee
hierarchy starting from “employee1”.
I will open up form view of “Mark Johnson” and test the wizard “Employee Hierarchy” so it display the employee
hierarchy starting from “Mark Johnson”.
- |
Now I will create new Job Position. I will check successfull creation of new Job Position by adding the information.
I will create new Job Position. I will check successfull creation of new Job Position by adding the information.
-
!record {model: hr.job, id: hr_job_jea0}:
department_id: 'hr_department_rd0'
@ -51,17 +51,17 @@
- state == 'open'
- |
I create Employee for this position in this Job Position form.
I create Employee for job position.
-
!record {model: hr.job, id: hr_job_jea0}:
employee_ids:
- address_home_id: base.res_partner_address_1
name: employee3
name: Manuel Lehba
department_id: 'hr_department_rd0'
gender: male
parent_id: 'hr_employee_employee0'
-
I check that "NO of Employee" is "1"
- |
I check that "Number of Employees" field have some value.
-
!assert {model: hr.job, id: hr_job_jea0}:
- no_of_employee != False

View File

@ -44,6 +44,7 @@
'wizard/hr_attendance_sign_in_out_view.xml',
],
'demo_xml': ['hr_attendance_demo.xml'],
'test': ['test/test_hr_attendance.yml'],
'installable': True,
'active': False,
'certificate': '0063495605613',

View File

@ -0,0 +1,109 @@
- |
In order to test hr_attendance module in OpenERP, I create new attendance and perform Sign In/Sign Out operation.
- |
First I create Employee "Mark Johnson".
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
name: Mark Johnson
user_id: base.user_root
- |
Given that I have Attendance Reason "Good Morning" for Sign In.
-
!record {model: hr.action.reason, id: hr_action_reason_goodmorning0}:
name: Good Morning
action_type: sign_in
- |
I also create another Attendance Reason for Sign Out.
-
!record {model: hr.action.reason, id: hr_action_reason_goodnight0}:
name: Good Night
action_type: sign_out
- |
Now , When I came in office , I create Atendances and perform "Sign In" action with proper reason.
-
!record {model: hr.attendance, id: hr_attendance_0}:
action: sign_in
action_desc: 'hr_action_reason_goodmorning0'
employee_id: 'hr_employee_employee0'
name: '2010-05-18 19:08:08'
- |
I check that Employee is in "Present" state.
-
!assert {model: hr.employee, id: hr_employee_employee0}:
- state == 'present'
- |
When I left office , I create attendance and perform "Sign Out".
-
!record {model: hr.attendance, id: hr_attendance_1}:
action: sign_out
employee_id: 'hr_employee_employee0'
name: '2010-05-18 19:10:55'
- |
I check that Employee is in "Absent" state.
-
!assert {model: hr.employee, id: hr_employee_employee0}:
- state == 'absent'
- |
I can also fill my attendance using "Sign In/Sign Out" wizard.
-
!record {model: hr.sign.in.out, id: hr_sign_in_out_markjohnson0}:
name: Mark Johnson
state: absent
- |
I click on "Sign In" button of this wizard to perform present action.
-
!python {model: hr.sign.in.out}: |
obj_attendance = self.pool.get('hr.employee')
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")])
if emp_id:
employee = obj_attendance.read(cr, uid, emp_id)[0]
self.write(cr, uid, [ref('hr_sign_in_out_markjohnson0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
self.si_check(cr, uid, [ref("hr_sign_in_out_markjohnson0")], {"active_id": ref("hr_employee_employee0")})
- |
I check that Employee is in "Present" state.
-
!assert {model: hr.employee, id: hr_employee_employee0}:
- state == 'present'
- |
I forgot to "Sign Out" in Yesterday and want to sign in Today using This wizard.
-
!record {model: hr.sign.in.out, id: hr_sign_in_out_markjohnson0}:
name: Mark Johnson
state: present
- |
I click on "Sign In" button of this wizard. that will Open new form which ask for Last Sign Out date.
-
!python {model: hr.sign.in.out}: |
obj_attendance = self.pool.get('hr.employee')
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")])
if emp_id:
employee = obj_attendance.read(cr, uid, emp_id)[0]
self.write(cr, uid, [ref('hr_sign_in_out_markjohnson0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
self.si_check(cr, uid, [ref("hr_sign_in_out_markjohnson0")])
- |
I select Last Sign Out date in "hr sign out ask" wizard.
-
!record {model: hr.sign.in.out.ask, id: hr_sign_in_out_ask_markjohnson0}:
last_time: !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: Mark Johnson
- |
Now I click on "Sign In" button of this wizard.
-
!python {model: hr.sign.in.out.ask}: |
obj_attendance = self.pool.get('hr.employee')
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")])
if emp_id:
employee = obj_attendance.read(cr, uid, emp_id)[0]
self.write(cr, uid, [ref('hr_sign_in_out_ask_markjohnson0')], {'emp_id': emp_id[0]})
#self.sign_in(cr, uid, [ref("hr_sign_in_out_ask_markjohnson0")], {"active_ids": [ref("hr_attendance.menu_hr_attendance_sigh_in_out")]})

View File

@ -33,16 +33,16 @@ class hr_si_so_ask(osv.osv_memory):
'emp_id': fields.char('Empoyee ID', size=32, required=True, readonly=True),
}
def _get_empname(self, cr, uid, context=None):
service = netsvc.LocalService('object_proxy')
emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)])
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
if emp_id:
employee = service.execute(cr.dbname, uid, 'hr.employee', 'read', emp_id)[0]
employee = emp_obj.read(cr, uid, emp_id)[0]
return employee['name']
return ''
def _get_empid(self, cr, uid, context=None):
service = netsvc.LocalService('object_proxy')
emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)])
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
if emp_id:
return emp_id[0]
return False
@ -74,10 +74,10 @@ class hr_sign_in_out(osv.osv_memory):
}
def _get_empid(self, cr, uid, context=None):
service = netsvc.LocalService('object_proxy')
emp_id = service.execute(cr.dbname, uid, 'hr.employee', 'search', [('user_id', '=', uid)])
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
if emp_id:
employee = service.execute(cr.dbname, uid, 'hr.employee', 'read', emp_id)[0]
employee = emp_obj.read(cr, uid, emp_id)[0]
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]}
return {}
@ -88,12 +88,13 @@ class hr_sign_in_out(osv.osv_memory):
return res
def si_check(self, cr, uid, ids, context=None):
service = netsvc.LocalService('object_proxy')
att_obj = self.pool.get('hr.attendance')
obj_model = self.pool.get('ir.model.data')
data = self.read(cr, uid, ids, [])[0]
emp_id = data['emp_id']
att_id = service.execute(cr.dbname, uid, 'hr.attendance', 'search', [('employee_id', '=', emp_id)], limit=1, order='name desc')
last_att = service.execute(cr.dbname, uid, 'hr.attendance', 'read', att_id)
att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id)], limit=1, order='name desc')
last_att = att_obj.read(cr, uid, att_id)
if last_att:
last_att = last_att[0]
cond = not last_att or last_att['action'] == 'sign_out'
@ -113,12 +114,13 @@ class hr_sign_in_out(osv.osv_memory):
}
def so_check(self, cr, uid, ids, context=None):
service = netsvc.LocalService('object_proxy')
att_obj = self.pool.get('hr.attendance')
obj_model = self.pool.get('ir.model.data')
data = self.read(cr, uid, ids, [])[0]
emp_id = data['emp_id']
att_id = service.execute(cr.dbname, uid, 'hr.attendance', 'search', [('employee_id', '=', emp_id),('action','!=','action')], limit=1, order='name desc')
last_att = service.execute(cr.dbname, uid, 'hr.attendance', 'read', att_id)
att_id = att_obj.search(cr, uid, [('employee_id', '=', emp_id),('action','!=','action')], limit=1, order='name desc')
last_att = att_obj.read(cr, uid, att_id)
if last_att:
last_att = last_att[0]
if not att_id and not last_att:
@ -151,31 +153,31 @@ class hr_sign_in_out(osv.osv_memory):
}
def sign_in(self, cr, uid, data, context=None):
service = netsvc.LocalService('object_proxy')
att_obj = self.pool.get('hr.attendance')
emp_id = data['emp_id']
if 'last_time' in data:
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
raise osv.except_osv(_('UserError'), _('The sign-out date must be in the past'))
service.execute(cr.dbname, uid, 'hr.attendance', 'create', {
att_obj.create(cr, uid, {
'name': data['last_time'],
'action': 'sign_out',
'employee_id': emp_id
})
try:
success = service.execute(cr.dbname, uid, 'hr.employee', 'attendance_action_change', [emp_id], 'sign_in')
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_in')
except:
raise osv.except_osv(_('UserError'), _('A sign-in must be right after a sign-out !'))
return {} # To do: Return Success message
def sign_out(self, cr, uid, data, context=None):
service = netsvc.LocalService('object_proxy')
att_obj = self.pool.get('hr_attendance')
emp_id = data['emp_id']
if 'last_time' in data:
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
raise osv.except_osv(_('UserError'), _('The Sign-in date must be in the past'))
service.execute(cr.dbname, uid, 'hr.attendance', 'create', {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id})
att_obj.create(cr, uid, {'name':data['last_time'], 'action':'sign_in', 'employee_id':emp_id})
try:
success = service.execute(cr.dbname, uid, 'hr.employee', 'attendance_action_change', [emp_id], 'sign_out')
success = self.pool.get('hr.employee').attendance_action_change(cr, uid, [emp_id], 'sign_out')
except:
raise osv.except_osv(_('UserError'), _('A sign-out must be right after a sign-in !'))
return {} # To do: Return Success message

View File

@ -3,7 +3,7 @@
I will create contract for "Mark Johnson" employee.
- |
First I create Employee "Mark Johnson"
I create Employee "Mark Johnson" to assign contract.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
@ -30,9 +30,9 @@
type: gross
- |
Now I start by create contract for "Mark Johnson".
Now I start by creating contract for "Mark Johnson".
Select wage type "Monthly Gross Wage" and Wage period "monthly"
which I have given.
which I had given.
-
!record {model: hr.contract, id: hr_contract_contract0}:
advantages_gross: 0.0

View File

@ -35,13 +35,14 @@
is done by the manager.Every evaluation filled by the employees can be viewed
in the form of.Implements a dashboard for My Current Evaluations """,
"init_xml" : [],
"demo_xml" : ["hr_evaluation_demo.xml"],
"demo_xml" : ["hr_evaluation_demo.xml",
],
"update_xml" : [
"security/ir.model.access.csv",
"wizard/hr_evaluation_mail_view.xml",
"hr_evaluation_view.xml",
"report/hr_evaluation_report_view.xml",
'board_hr_evaluation_view.xml',],
"report/hr_evaluation_report_view.xml"],
"test": ["test/test_hr_evaluation.yml"],
"active": False,
"installable": True
}

View File

@ -0,0 +1,152 @@
- |
In order to test hr_evaluation module for OpenERP, I will create plan then create evaluation under that plan.
-
|
Given that I have "R & D" Department for employee.
-
!record {model: hr.department, id: hr_department_rd0}:
manager_id: base.user_root
name: 'R & D '
-
|
Given that I have Employee “Mark Johnson” which take Interview.
select "R & D" Department.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
marital: hr.hr_employee_marital_status_single
name: Mark Johnson
user_id: base.user_root
department_id: 'hr_department_rd0'
- |
I create new employee “Phil Graves ” and select "Mark Johnson" as
Manager.
-
!record {model: hr.employee, id: hr_employee_employee1}:
address_home_id: base.res_partner_address_3000
company_id: base.main_company
gender: male
name: Phil Graves
user_id: base.user_demo
parent_id: 'hr_employee_employee0'
- |
I Create "Employee Evaluation" survey for Manager's Evaluation Plan.
-
!record {model: 'survey', id: survey_0}:
title: 'Employee Evaluation'
max_response_limit: 20
response_user: 2
- |
I Create "Employee Evaluation" page in "Employee Evaluation" survey.
-
!record {model: 'survey.page', id: survey_employee_page_0}:
title: 'Employee Evaluation'
survey_id: survey_0
- |
I Create "What is your Name" question in "Employee Evaluation" survey page.
-
!record {model: 'survey.question', id: survey_p_question_0}:
question: 'What is your Name?'
type: 'single_textbox'
sequence: 1
page_id: survey_employee_page_0
- |
I Create "What is your gender" Question in "Employee Evaluation" survey page.
-
!record {model: 'survey.question', id: survey_p_question_1}:
question: 'What is your gender?'
type: multiple_choice_only_one_ans
sequence: 2
is_require_answer: true
page_id: survey_employee_page_0
- |
I Create "Male" answer in question "What is your gender?"
-
!record {model: 'survey.answer', id: survey_p_1_1}:
answer: 'Male'
sequence: 1
question_id : survey_p_question_1
- |
I Create "Female" answer in question "What is your gender?"
-
!record {model: 'survey.answer', id: survey_p_1_2}:
answer: 'Female'
sequence: 2
question_id : survey_p_question_1
- |
Now Survey set in open state.
-
!python {model: survey}: |
self.survey_open(cr, uid, [ref("survey_0")], context)
- |
I creating a Evaluation plan and select "Employee Evaluation" survey for "Send to Subordinates" and "Final interview with Manager" Phase.
-
!record {model: hr_evaluation.plan, id: hr_evaluation_plan_managersplan0}:
company_id: base.main_company
month_first: 3
month_next: 6
name: Manager's Plan
phase_ids:
- action: bottom-up
name: Send to Subordinates
survey_id: 'survey_0'
- action: top-down
name: Final Interview with manager
sequence: 2
survey_id: 'survey_0'
- |
Now I create Evaluation for "Phil Graves" Employee under "Manager Evaluation Plan".
-
!record {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
date: '2010-06-28'
employee_id: 'hr_employee_employee1'
plan_id: 'hr_evaluation_plan_managersplan0'
progress: 0.0
state: draft
- |
I check that Evaluation is in "Draft" state.
-
!assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
- state == 'draft'
- |
I start Evaluation process by click on "Start Evaluation" button.
-
!python {model: hr_evaluation.evaluation}: |
self.button_plan_in_progress(cr, uid, [ref('hr_evaluation_evaluation_0')])
- |
After that Manager Evaluation plan is In Progress.
I close this servey request by giving answer of survey question.
-
!python {model: hr.evaluation.interview}: |
self.survey_req_done(cr, uid, [ref('hr_evaluation_evaluation_0')])
- |
I click on "Final Validation" button to finalize Evaluation.
-
!python {model: hr_evaluation.evaluation}: |
self.button_final_validation(cr, uid, [ref("hr_evaluation.hr_evaluation_evaluation_0")],
{"active_ids": [ref("hr_evaluation.menu_open_view_hr_evaluation_tree")]})
- |
I check that state is "Final Validation".
-
!assert {model: hr_evaluation.evaluation, id: hr_evaluation_evaluation_0}:
- state == 'progress'
- |
Give Rating "Meet expectations" by selecting overall Rating.
-
!record {model: hr_evaluation.evaluation, id: hr_evaluation.hr_evaluation_evaluation_0}:
rating: '2'
- |
I close this Evaluation by click on "Done" button of this wizard.
-
!python {model: hr_evaluation.evaluation}: |
self.button_done(cr, uid, [ref("hr_evaluation.hr_evaluation_evaluation_0")], {"active_ids": [ref("hr_evaluation.menu_open_view_hr_evaluation_tree")]})

View File

@ -1,6 +1,5 @@
- |
In order to test the hr_holiday in OpenERP, I will Manage leaves for employee,
Leave requests.
In order to test the hr_holiday in OpenERP, I will Allocate leaves for Employee and manage leaves and leaves requests.
- |
For that First I create new user "user1" to make leave request.
-
@ -15,7 +14,7 @@
name: user1
password: user1
- |
Now, I create a new employee “Mark Johnshon” as Manager to validate employee leave.
I create a new employee “Mark Johnshon” as Manager to validate employee leave.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
@ -24,11 +23,11 @@
name: Mark Johnson
user_id: base.user_root
- |
create another employee "Brijesh Patel" as "user1" who make leave request.
Create another employee "Phil Graves" as "user1" who make leave request.
-
!record {model: hr.employee, id: hr_employee_brijeshpatel0}:
!record {model: hr.employee, id: hr_employee_philgraves0}:
address_home_id: base.res_partner_address_8
name: Brijesh Patel
name: Phil Graves
parent_id: 'hr_employee_employee0'
user_id: 'res_users_user0'
- |
@ -40,11 +39,11 @@
limit: 1
- |
After that I allocate leave request for employee "Brijesh Patel".
After that I allocate leave request for employee "Phil Graves".
-
!record {model: hr.holidays, id: hr_holidays_allocateleaveforuser0}:
allocation_type: employee
employee_id: 'hr_employee_brijeshpatel0'
employee_id: 'hr_employee_philgraves0'
holiday_status_id: hr_holidays_status_fullleave0
name: Allocate leave for user1
number_of_days_temp: 12.0
@ -62,13 +61,13 @@
!workflow {model: hr.holidays, action: validate, ref: hr_holidays_allocateleaveforuser0}
- |
Now employee "Brijesh Patel" want to leave. so, I connect as user1 which is username of this employee and want to make leave request.
Now employee "Phil Graves" want to leave. so, I connect as user1 which is username of this employee and want to make leave request.
-
!record {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
allocation_type: employee
date_from: '2010-05-20 11:48:00'
date_to: '2010-05-21 11:48:00'
employee_id: 'hr_employee_brijeshpatel0'
employee_id: 'hr_employee_philgraves0'
holiday_status_id: 'hr_holidays_status_fullleave0'
name: I want to leave for go to hospital
notes: I want to leave for go to hospital. so please accept my leave.
@ -82,12 +81,12 @@
- state == 'draft'
- |
Now I confirm my leave Request by click on "Confirm" button.
I confirm my leave Request by click on "Confirm" button.
-
!workflow {model: hr.holidays, action: confirm, ref: hr_holidays_iwanttoleaveforgotohospital0}
- |
Now I connect as Admin user and Open Leave request of "Brijesh Patel".
I connect as Admin user and Open Leave request of "Phil Graves".
and "validate" it by click on "validate" button.
-
!workflow {model: hr.holidays, action: validate, ref: hr_holidays_iwanttoleaveforgotohospital0}

View File

@ -1,10 +1,10 @@
- |
In order to test hr_recruitment module for OpenERP object, I create applicants form and Manages job positions and the recruitement process.
In order to test hr_recruitment module for OpenERP, I will create applicants form, Manages job positions and the recruitement process.
- |
I create job possition for employee to manage job position.
I create job position for employee to manage job position.
-
|
First I create Department "R & D" in Department form for which I make recruitment.
For that First I create Department "R & D" in Department form for which I make recruitment.
-
!record {model: hr.department, id: hr_department_rd0}:
manager_id: base.user_root

View File

@ -51,6 +51,7 @@ to set up a management by affair.
],
'demo_xml': ['hr_timesheet_demo.xml'],
'test': ['test/test_hr_timesheet.yml'],
'installable': True,
'active': False,
'certificate': '0071405533469',

View File

@ -0,0 +1,96 @@
- |
In order to test hr_timesheet Module in OpenERP, I make "Sign In or Sign Out for Project" to encode and
track time spent on the different projects.
- |
Now, I create a new employee “Mark Johnson” to test Timesheet.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
marital: hr.hr_employee_marital_status_single
name: Mark Johnson
user_id: base.user_root
- |
I start by "Sign In/Sign Out by Project" wizard and click on "Sign In/Sign Out" button of this wizard.
-
!python {model: hr.sign.in.project}: |
self.check_state(cr, uid, [ref("hr_employee_employee0")])
- |
I select start date and Perform start work on project.
-
!record {model: hr.sign.in.project, id: hr_employee_employee0}:
name: employee1
server_date: '2010-05-20 16:10:59'
state: absent
- |
I click on "Start Working" button of this wizard to start work on Project.
-
!python {model: hr.sign.in.project}: |
self.sign_in_result(cr, uid, [ref("hr_employee_employee0")], context)
- |
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.
Which check state in hr attendace form for user.
-
!python {model: hr.sign.in.project}: |
obj_attendance = self.pool.get('hr.employee')
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "employee1")])
if emp_id:
employee = obj_attendance.read(cr, uid, emp_id)[0]
self.write(cr, uid, [ref('hr_employee_employee0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
self.check_state(cr, uid, [ref("hr_employee_employee0")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")]
})
- |
Given that I have product for "Consultancy - Senior Developer".
-
!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
- |
I assing product and journal to "Mark Johnson"
-
!record {model: hr.employee, id: hr_employee_employee0}:
journal_id: analytic_journal
product_id: product_consultant
- |
This will Open "hr sign out project" form. I select analytical project2 development account.
-
!record {model: hr.sign.out.project, id: hr_employee_employee0}:
account_id: account.analytic_project_2_development
analytic_amount: 7.0
date: '2010-05-21 16:40:00'
date_start: '2010-05-19 16:37:00'
info: Create Yaml for hr module
name: Mark Johnson
server_date: '2010-05-19 16:40:15'
state: present
- |
My work for this project is over and I stop work by click on "Stop Work" button of this wizard.
-
!python {model: hr.sign.out.project}: |
emp_obj = self.pool.get('hr.employee')
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid), ('name', '=', 'employee1')])
if emp_id:
employee = emp_obj.read(cr, uid, emp_id)[0]
self.write(cr, uid, [ref('hr_employee_employee0')], {'emp_id': emp_id[0] })
#self.sign_out_result(cr, uid, [ref('hr_employee_employee0')])
- |
I can see employee timesheet for particular month using "Employee Timesheet" report.

View File

@ -45,7 +45,9 @@ reports, eso.""",
'wizard/hr_timesheet_invoice_create_final_view.xml',
'board_hr_timesheet_invoice.xml',
],
'demo_xml': ['hr_timesheet_invoice_demo.xml'],
'demo_xml': ['hr_timesheet_invoice_demo.xml',
],
'test': ['test/test_hr_timesheet_invoice.yml'],
'installable': True,
'active': False,
'certificate': '0056091842381',

View File

@ -0,0 +1,89 @@
- |
In order to test hr_timesheet_invoice in OpenERP, I create account line to manage invoice based on costs.
- |
In order to test flow, I create analytic line for sednacom analytic account.
-
!record {model: account.analytic.line, id: account_analytic_line_developyamlforhrmodule0}:
account_id: account.analytic_sednacom
amount: -1.0
company_id: base.main_company
date: '2010-05-30'
general_account_id: account.a_expense
journal_id: hr_timesheet.analytic_journal
name: develop yaml for hr module
product_id: hr_timesheet.product_consultant
product_uom_id: product.uom_hour
to_invoice: hr_timesheet_invoice.timesheet_invoice_factor2
unit_amount: 5.00
user_id: base.user_root
- |
Give partner name and price list in analytic account.
-
!record {model: account.analytic.account, id: account.analytic_sednacom}:
partner_id: base.res_partner_9
pricelist_id: product.list0
- |
I create invoice on analytic Line using "Invoice analytic Line" wizard.
Give date , detail of each work , time spend on that work on this wizard.
-
!record {model: hr.timesheet.invoice.create, id: hr_timesheet_invoice_create_0}:
accounts:
- account.analytic_sednacom
date: 1
name: 1
price: 1
product: hr_timesheet.product_consultant
time: 1
- |
I click on "Create Invoice" button of "Invoice analytic Line" wizard to create invoice.
-
!python {model: hr.timesheet.invoice.create}: |
self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_0")], {"active_ids": [ref("hr_timesheet_invoice.account_analytic_line_developyamlforhrmodule0")]})
- |
I check that Invoice is create for this timesheet.
-
!python {model: account.analytic.line}: |
exp = self.browse(cr, uid, [ref('account_analytic_line_developyamlforhrmodule0')])[0]
analytic_account_obj = self.pool.get('account.analytic.account')
data = self.pool.get('hr.timesheet.invoice.create').read(cr, uid, [ref("hr_timesheet_invoice_create_0")], [], context)[0]
account_ids = data['accounts']
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id.id
invoice_obj = self.pool.get('account.invoice')
invoice_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner)])
invoice_id = invoice_obj.browse(cr, uid, invoice_ids)[0]
for invoice in invoice_id.invoice_line:
product = invoice.product_id.id
product_exp = data['product']
assert product == product_exp
- |
I creating a final invoice for "Sednacom" analytic account.
-
!record {model: hr.timesheet.invoice.create.final, id: hr_timesheet_invoice_create_final_0}:
balance_product: hr_timesheet.product_consultant
date: 1
name: 1
price: 1
time: 1
- |
I click on "Create Invoice" button to create Invoice.
-
!python {model: hr.timesheet.invoice.create.final}: |
self.do_create(cr, uid, [ref("hr_timesheet_invoice_create_final_0")], {"active_ids": [ref("account.analytic_sednacom")]})
- |
I can also make some theoretical revenue reports.
- |
I can also see timesheet profit using Timesheet profit report.

View File

@ -71,8 +71,8 @@ class hr_timesheet_invoice_create(osv.osv_memory):
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
data = self.read(cr, uid, ids, [], context)[0]
account_ids = data['accounts']
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id
@ -119,11 +119,11 @@ class hr_timesheet_invoice_create(osv.osv_memory):
"GROUP BY product_id,to_invoice", (account.id,context['active_ids'],))
for product_id,factor_id,qty in cr.fetchall():
product = pool.get('product.product').browse(cr, uid, product_id, context2)
product = self.pool.get('product.product').browse(cr, uid, product_id, context2)
if not product:
raise osv.except_osv(_('Error'), _('At least one line has no product !'))
factor_name = ''
factor = pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2)
factor = self.pool.get('hr_timesheet_invoice.factor').browse(cr, uid, factor_id, context2)
if not data['product']:
if factor.customer_name:
@ -131,16 +131,16 @@ class hr_timesheet_invoice_create(osv.osv_memory):
else:
factor_name = product.name
else:
factor_name = pool.get('product.product').name_get(cr, uid, [data['product']], context=context)[0][1]
factor_name = self.pool.get('product.product').name_get(cr, uid, [data['product']], context=context)[0][1]
if account.pricelist_id:
pl = account.pricelist_id.id
price = pool.get('product.pricelist').price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
price = self.pool.get('product.pricelist').price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl]
else:
price = 0.0
taxes = product.taxes_id
tax = pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
tax = self.pool.get('account.fiscal.position').map_tax(cr, uid, account.partner_id.property_account_position, taxes)
account_id = product.product_tmpl_id.property_account_income.id or product.categ_id.property_account_income_categ.id
curr_line = {
'price_unit': price,
@ -159,7 +159,7 @@ class hr_timesheet_invoice_create(osv.osv_memory):
#
# Compute for lines
#
cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id = ANY (%s) AND product_id=%s and to_invoice=%s", (account.id, data['ids'], product_id, factor_id))
cr.execute("SELECT * FROM account_analytic_line WHERE account_id = %s and id = %s AND product_id=%s and to_invoice=%s", (account.id, data['id'], product_id, factor_id))
line_ids = cr.dictfetchall()
note = []
@ -170,7 +170,7 @@ class hr_timesheet_invoice_create(osv.osv_memory):
details.append(line['date'])
if data['time']:
if line['product_uom_id']:
details.append("%s %s" % (line['unit_amount'], pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name))
details.append("%s %s" % (line['unit_amount'], self.pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name))
else:
details.append("%s" % (line['unit_amount'], ))
if data['name']:
@ -180,8 +180,8 @@ class hr_timesheet_invoice_create(osv.osv_memory):
note.append(u' - '.join(map(lambda x: unicode(x) or '',details)))
curr_line['note'] = "\n".join(map(lambda x: unicode(x) or '',note))
pool.get('account.invoice.line').create(cr, uid, curr_line)
cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id =ANY(%s)" ,(last_invoice, account.id,data['ids']))
self.pool.get('account.invoice.line').create(cr, uid, curr_line)
cr.execute("update account_analytic_line set invoice_id=%s WHERE account_id = %s and id =%s" ,(last_invoice, account.id,data['id']))
self.pool.get('account.invoice').button_reset_taxes(cr, uid, [last_invoice], context)

View File

@ -56,7 +56,10 @@ The validation can be configured in the company:
'report/timesheet_report_view.xml',
'board_hr_timesheet_view.xml',
],
'demo_xml': ['hr_timesheet_sheet_demo.xml'],
'demo_xml': ['hr_timesheet_sheet_demo.xml',
],
'test':['test/test_hr_timesheet_sheet.yml'],
'installable': True,
'active': False,
'certificate': '0073297700829',

View File

@ -151,13 +151,16 @@ class hr_timesheet_sheet(osv.osv):
raise osv.except_osv(_('Error !'), _('You can not duplicate a timesheet !'))
def button_confirm(self, cr, uid, ids, context=None):
if context is None:
context = {}
for sheet in self.browse(cr, uid, ids, context=context):
di = sheet.user_id.company_id.timesheet_max_difference
if (abs(sheet.total_difference) < di) or not di:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'hr_timesheet_sheet.sheet', sheet.id, 'confirm', cr)
else:
raise osv.except_osv(_('Warning !'), _('Please verify that the total difference of the sheet is lower than %.2f !') %(di,))
return True

View File

@ -0,0 +1,139 @@
- |
In order, to test hr_timesheet_sheet module in OpenERP, I create timesheet and check validation process done by
manager.
- |
Now, I create a new employee “Mark Johnson” to test Timesheet.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
gender: male
marital: hr.hr_employee_marital_status_single
name: Mark Johnson
user_id: base.user_root
- |
I create new user "user1".
-
!record {model: res.users, id: res_users_user0}:
company_id: base.main_company
context_lang: en_US
groups_id:
- hr.group_hr_user
- hr_attendance.group_hr_attendance
- base.group_user
- base.group_extended
- hr.group_hr_manager
login: user1
name: user1
password: user1
- |
create another employee "Francline" as "user1".
-
!record {model: hr.employee, id: hr_employee_fracline0}:
address_home_id: base.res_partner_address_8
name: Francline
parent_id: 'hr_employee_employee0'
user_id: 'res_users_user0'
- |
Given that I have Timesheet journal for employee.
-
!record {model: account.analytic.journal, id: analytic_journal}:
code: TS
name: Timesheet Journal
type: general
- |
Given that I have product for "Consultancy - Senior Developer".
-
!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
- |
I assing product and journal to "Mark Johnson"
-
!record {model: hr.employee, id: hr_employee_employee0}:
product_id: product_consultant
journal_id: analytic_journal
- |
And also assing product and journal to "francline" employee.
-
!record {model: hr.employee, id: hr_employee_fracline0}:
product_id: product_consultant
journal_id: analytic_journal
- |
I connect as "francline" and create my current timesheet.
-
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
date_current: '2010-05-26'
date_from: '2010-05-01'
date_to: '2010-05-31'
name: Week-22(2010)
state: new
user_id: 'res_users_user0'
- |
Now , When I came in office , I create Attendances and perform "Sign In" action with proper reason.
-
!record {model: hr.attendance, id: hr_attendance_0}:
action: sign_in
employee_id: 'hr_employee_fracline0'
name: '2010-05-26 10:08:08'
- |
When I left office , I create attendance and perform "Sign Out".
-
!record {model: hr.attendance, id: hr_attendance_1}:
action: sign_out
employee_id: 'hr_employee_fracline0'
name: '2010-05-26 15:10:55'
-
I create Timesheet Entry for time spend on today work.
-
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet.sheet1}:
timesheet_ids:
- account_id: account.analytic_sednacom
date: '05/26/2010'
name: 'Develop yaml for hr module'
unit_amount: 5.00
amount: -90.00
product_id: hr_timesheet.product_consultant
general_account_id: account.a_expense
user_id: res_users_user0
journal_id: hr_timesheet.analytic_journal
- |
I confirm my timesheet at end of period by click on "Confirm" button which is signal of workflow.
-
!python {model: hr_timesheet_sheet.sheet}: |
uid = ref('res_users_user0')
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')])
- |
I check that state is "Confirmed".
-
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
- state == 'confirm'
- |
"Mark Johnson" check timesheet and time spend on project by "francline" employee.
And then accept it request by click on "Accept" button.
If "Maximal difference between timesheet and attendances" is more than 1 then manage can "Refuse" his request.
-
!python {model: hr_timesheet_sheet.sheet}: |
#self.write(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {'state': 'done'})