~openerp-dev/openobject-addons/6.1-opw-579908-msh

« back to all changes in this revision

Viewing changes to hr_timesheet/test/test_hr_timesheet.yml

  • Committer: atp (Open ERP)
  • Date: 2010-05-31 08:17:27 UTC
  • mto: (3164.3.419 trunk-dev-addons3)
  • mto: This revision was merged to the branch mainline in revision 3437.
  • Revision ID: atp@tinyerp.co.in-20100531081727-8h30d52ydh6fls44
[ADD]: hr_timesheet: add yaml for hr_timesheet module.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
- |
 
2
  In order to test hr_timesheet Module in OpenERP, I make "Sign In or Sign Out for Project" to encode and
 
3
  track  time spent on the different projects.
 
4
       
 
5
- |
 
6
  Now, I  create a new employee “Mark Johnson” to test Timesheet.
 
7
     
 
8
-
 
9
  !record {model: hr.employee, id: hr_employee_employee0}:
 
10
    address_home_id: base.res_partner_address_1
 
11
    company_id: base.main_company
 
12
    gender: male
 
13
    marital: hr.hr_employee_marital_status_single
 
14
    name: Mark Johnson
 
15
    user_id: base.user_root
 
16
  
 
17
- |
 
18
  I start by "Sign In/Sign Out by Project" wizard and click on "Sign In/Sign Out" button of this wizard.
 
19
-
 
20
  !python {model: hr.sign.in.project}: |
 
21
    self.check_state(cr, uid, [ref("hr_employee_employee0")])
 
22
- |
 
23
  I select start date and Perform start work on project. 
 
24
-
 
25
  !record {model: hr.sign.in.project, id: hr_employee_employee0}:
 
26
    name: employee1
 
27
    server_date: '2010-05-20 16:10:59'
 
28
    state: absent
 
29
- |
 
30
  I click on "Start Working" button of this wizard to start work on Project.
 
31
 
32
  !python {model: hr.sign.in.project}: |
 
33
      self.sign_in_result(cr, uid, [ref("hr_employee_employee0")], context)
 
34
- |
 
35
  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.
 
36
  Which check state in hr attendace form for user.
 
37
 
38
  !python {model: hr.sign.in.project}: |
 
39
    obj_attendance = self.pool.get('hr.employee')
 
40
    emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "employee1")])
 
41
    if emp_id:
 
42
       employee = obj_attendance.read(cr, uid, emp_id)[0]
 
43
       self.write(cr, uid, [ref('hr_employee_employee0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
 
44
       self.check_state(cr, uid, [ref("hr_employee_employee0")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")]
 
45
             })
 
46
 
 
47
- |
 
48
  Given that I have product for "Consultancy - Senior Developer".
 
49
 
 
50
 
51
  !record {model: product.product, id: product_consultant}:
 
52
    categ_id: product.product_category_10
 
53
    default_code: DEV
 
54
    list_price: 75.0
 
55
    name: Consultancy - Senior Developer
 
56
    procure_method: make_to_order
 
57
    purchase_ok: False
 
58
    standard_price: 30.0
 
59
    supply_method: produce
 
60
    type: service
 
61
    uom_id: product.uom_hour
 
62
    uom_po_id: product.uom_hour
 
63
 
 
64
 
 
65
- |
 
66
  I assing product and journal to  "Mark Johnson" 
 
67
 
68
  !record {model: hr.employee, id: hr_employee_employee0}:
 
69
    journal_id: analytic_journal
 
70
    product_id: product_consultant      
 
71
      
 
72
- |
 
73
  This will Open "hr sign out project" form. I select analytical project2 development account.     
 
74
 
75
  !record {model: hr.sign.out.project, id: hr_employee_employee0}:
 
76
    account_id: account.analytic_project_2_development
 
77
    analytic_amount: 7.0
 
78
    date: '2010-05-21 16:40:00'
 
79
    date_start: '2010-05-19 16:37:00'
 
80
    info: Create Yaml for hr module
 
81
    name: Mark Johnson
 
82
    server_date: '2010-05-19 16:40:15'
 
83
    state: present
 
84
    
 
85
- |
 
86
  My work for this project is over and I stop work by click on "Stop Work" button of this wizard.
 
87
 
88
  !python {model: hr.sign.out.project}: |
 
89
    emp_obj = self.pool.get('hr.employee')
 
90
    emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid), ('name', '=', 'employee1')])
 
91
    if emp_id:
 
92
       employee = emp_obj.read(cr, uid, emp_id)[0]
 
93
       self.write(cr, uid, [ref('hr_employee_employee0')], {'emp_id': emp_id[0] })
 
94
       #self.sign_out_result(cr, uid, [ref('hr_employee_employee0')])
 
95
 
 
96
- |
 
97
  I can see employee timesheet for particular month using "Employee Timesheet" report.
 
 
b'\\ No newline at end of file'