[ADD]: hr_timesheet_sheet: develop yaml for hr_timesheet_sheet module.
bzr revid: atp@tinyerp.co.in-20100531122943-5vc1sbbecjn98pwf
This commit is contained in:
parent
65afc2f1f4
commit
77d6728006
|
@ -55,7 +55,10 @@ The validation can be configured in the company:
|
|||
'process/hr_timesheet_sheet_process.xml',
|
||||
'report/timesheet_report_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_sheet_demo.xml'],
|
||||
'demo_xml': ['hr_timesheet_sheet_demo.xml',
|
||||
'test/test_hr_timesheet_sheet.yml'
|
||||
],
|
||||
'test':[],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0073297700829',
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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'})
|
||||
|
Loading…
Reference in New Issue