odoo/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml

139 lines
4.2 KiB
YAML
Raw Normal View History

- |
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'})