[IMP] hr improvements
authorPSI(OpenERP) <>
Fri, 20 Aug 2010 11:30:54 +0000 (17:00 +0530)
committerMustufa Rangwala <mra@mra-laptop>
Fri, 20 Aug 2010 11:30:54 +0000 (17:00 +0530)
bzr revid: mra@mra-laptop-20100820113054-mayxce6dsf6b316n

addons/hr/hr_department_view.xml
addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml
addons/hr_evaluation/hr_evaluation.py
addons/hr_holidays/hr_holidays_demo.xml
addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml

index 1b96956..c2bb6ac 100644 (file)
@@ -76,7 +76,7 @@
         </record>
 
        <menuitem action="open_module_tree_department" id="menu_department_def" parent="hr.menu_department_tree"/>
-       <menuitem action="open_module_tree_department" id="menu_hr_department_tree" parent="menu_hr_main" sequence="5"/>
+       <menuitem action="open_module_tree_department" id="menu_hr_department_tree" parent="hr.menu_hr_management" sequence="6"/>
 
         <record model="ir.ui.view" id="view_users_form_inherit">
             <field name="name">res.users.form</field>
index 8d3aa34..e9b5fec 100644 (file)
@@ -19,7 +19,7 @@
         </record>
 
         <record id="action_hr_attendance_month" model="ir.actions.act_window">
-            <field name="name">Attendances by month</field>
+            <field name="name">Attendances By Month</field>
             <field name="type">ir.actions.act_window</field>
             <field name="res_model">hr.attendance.month</field>
             <field name="view_type">form</field>
@@ -30,7 +30,7 @@
         <record model="ir.values" id="hr_attendance_month_values">
             <field name="model_id" ref="hr.model_hr_employee" />
             <field name="object" eval="1" />
-            <field name="name">Attendances by month</field>
+            <field name="name">Attendances By Month</field>
             <field name="key2">client_print_multi</field>
             <field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_attendance_month'))" />
             <field name="key">action</field>
index b4743a7..0b497c4 100644 (file)
@@ -36,11 +36,11 @@ class hr_evaluation_plan(osv.osv):
         'month_first': fields.integer('First Evaluation After'),
         'month_next': fields.integer('Next Evaluation After'),
         'active': fields.boolean('Active')
-        }
+    }
     _defaults = {
         'active': True,
         'company_id': lambda s,cr,uid,c: s.pool.get('res.company')._company_default_get(cr, uid, 'account.account', context=c),
-        }
+    }
 hr_evaluation_plan()
 
 class hr_evaluation_plan_phase(osv.osv):
@@ -131,7 +131,7 @@ class hr_employee(osv.osv):
                     evaluation_date=(dt.ISO.ParseAny(evaluation_date)+ dt.RelativeDateTime(months=+evaluation_plan.month_next)).strftime('%Y-%m-%d')
                     flag = True
             if ids and flag:
-                self.pool.get("hr_evaluation.evaluation").create(cr, uid, {'employee_id': ids[0], 'plan_id': evaluation_plan_id}, context=context)
+                obj_evaluation.create(cr, uid, {'employee_id': ids[0], 'plan_id': evaluation_plan_id}, context=context)
         return {'value': {'evaluation_date': evaluation_date}}
 
     def create(self, cr, uid, vals, context=None):
@@ -139,7 +139,7 @@ class hr_employee(osv.osv):
             context = {}
         id = super(hr_employee, self).create(cr, uid, vals, context=context)
         if vals.get('evaluation_plan_id', False):
-            obj_evaluation.create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']}, context=context)
+            self.pool.get('hr_evaluation.evaluation').create(cr, uid, {'employee_id' : id, 'plan_id': vals['evaluation_plan_id']}, context=context)
         return id
 
 hr_employee()
@@ -289,10 +289,10 @@ class hr_evaluation_interview(osv.osv):
         'request_id': fields.many2one('survey.request','Request_id', ondelete='cascade', required=True),
         'user_to_review_id': fields.many2one('hr.employee', 'Employee to Interview'),
         'evaluation_id': fields.many2one('hr_evaluation.evaluation', 'Evaluation Type'),
-        }
+    }
     _defaults = {
         'is_evaluation': True,
-        }
+    }
 
     def survey_req_waiting_answer(self, cr, uid, ids, context=None):
         if context is None:
index 2ea95b7..bfa051d 100644 (file)
@@ -1,52 +1,52 @@
 <?xml version="1.0"?>
 <openerp>
-       <data noupdate="1">
+  <data noupdate="1">
 
-               <!-- Casual leave -->
-               <record model="hr.holidays.status" id="holiday_status_cl">
-                       <field name="name">Casual Leave</field>
-                       <field name="double_validation">True</field>
-                       <field name="color_name">black</field>
-               </record>
+    <!-- Casual leave -->
+    <record model="hr.holidays.status" id="holiday_status_cl">
+      <field name="name">Casual Leave</field>
+      <field name="double_validation">True</field>
+      <field name="color_name">black</field>
+    </record>
 
-        <record model="hr.holidays" id="hr_holidays_employee1_allocation_cl">
-            <field name="name">Casual Leave for Fabien Pinckaers</field>
-            <field name="holiday_status_id" ref="holiday_status_cl"/>
-            <field name="type">add</field>
-            <field name="number_of_days_temp">12</field>
-            <field name="employee_id" ref="hr.employee1"/>
-        </record>
+    <record model="hr.holidays" id="hr_holidays_employee1_allocation_cl">
+        <field name="name">Casual Leave for Fabien Pinckaers</field>
+        <field name="holiday_status_id" ref="holiday_status_cl"/>
+        <field name="type">add</field>
+        <field name="number_of_days_temp">12</field>
+        <field name="employee_id" ref="hr.employee1"/>
+    </record>
 
-               <record model="hr.holidays" id="hr_holidays_employee1_cl">
-                       <field name="name">Trip with Family</field>
-                       <field name="holiday_status_id" ref="holiday_status_cl"/>
-                       <field name="date_from">2010-01-04 08:00</field>
-                       <field name="date_to">2010-01-06 18:00</field>
-                       <field name="type">remove</field>
-                       <field name="number_of_days_temp">3</field>
-                       <field name="employee_id" ref="hr.employee1"/>
-               </record>
+    <record model="hr.holidays" id="hr_holidays_employee1_cl">
+      <field name="name">Trip with Family</field>
+      <field name="holiday_status_id" ref="holiday_status_cl"/>
+      <field eval="time.strftime('%Y-%m-01')" name="date_from"/>
+      <field eval="time.strftime('%Y-%m-03')" name="date_to"/>
+      <field name="type">remove</field>
+      <field name="number_of_days_temp">3</field>
+      <field name="employee_id" ref="hr.employee1"/>
+    </record>
 
-               <!-- Sick leave -->
-               <record model="hr.holidays.status" id="holiday_status_sl">
-                       <field name="name">Sick Leave</field>
-                       <field name="limit">True</field>
-                       <field name="color_name">red</field>
-               </record>
+    <!-- Sick leave -->
+    <record model="hr.holidays.status" id="holiday_status_sl">
+      <field name="name">Sick Leave</field>
+      <field name="limit">True</field>
+      <field name="color_name">red</field>
+    </record>
 
-               <record model="hr.holidays" id="hr_holidays_employee1_sl">
-                       <field name="name">Doctor Appointment</field>
-                       <field name="holiday_status_id" ref="holiday_status_sl"/>
-                       <field name="date_from">2010-02-01 00:00</field>
-                       <field name="date_to">2010-02-03 08:00</field>
-                       <field name="type">remove</field>
-                       <field name="state">draft</field>
-                       <field name="number_of_days_temp">3</field>
-                       <field name="employee_id" ref="hr.employee1"/>
-               </record>
+    <record model="hr.holidays" id="hr_holidays_employee1_sl">
+      <field name="name">Doctor Appointment</field>
+      <field name="holiday_status_id" ref="holiday_status_sl"/>
+      <field eval="time.strftime('%Y-%m-20')" name="date_from"/>
+      <field eval="time.strftime('%Y-%m-22')" name="date_to"/>
+      <field name="type">remove</field>
+      <field name="state">draft</field>
+      <field name="number_of_days_temp">3</field>
+      <field name="employee_id" ref="hr.employee1"/>
+    </record>
 
-        <workflow action="confirm" model="hr.holidays" ref="hr_holidays_employee1_sl"/>
-        <workflow action="validate" model="hr.holidays" ref="hr_holidays_employee1_sl"/>
+    <workflow action="confirm" model="hr.holidays" ref="hr_holidays_employee1_sl"/>
+    <workflow action="validate" model="hr.holidays" ref="hr_holidays_employee1_sl"/>
 
-       </data>
+  </data>
 </openerp>
index 1486d7f..d75968f 100644 (file)
     timesheet_max_difference: 1.0
 
 -
+  I assign this company to Admin user
+-
+  !record {model: res.users, id: base.user_root}:
+    company_id: res_company_openERP
+    company_ids:
+      - base.main_company
+      - res_company_openERP
+
+-
   I  create a new employee “Mark Johnson”.
 -
   !record {model: hr.employee, id: hr_employee_employee0}:
@@ -81,7 +90,7 @@
   I create Timesheet Entry for time spend on today work.
 
 -
-  !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet.sheet1}:
+  !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
     timesheet_ids:
       - account_id: account.analytic_sednacom
         date: '05/26/2010'
    if the difference between timesheet hour and attendance hour is more than 1 hour it will give message.
 -
   !python {model: hr_timesheet_sheet.sheet}: |
-    uid = ref('base.user_root')
-    import netsvc
-    for sheet in self.browse(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')]):
-        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:
-            print "Please verify that the total difference of the sheet is lower than %.2f"   %di
+        uid = ref('base.user_root')
+        import netsvc
+        try:
+            self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {"lang": 'en_US', "active_ids":
+              [ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form")], "tz": False, "active_model":
+              "ir.ui.menu", "department_id": False, "section_id": False, "search_default_my_timesheet":
+              1, "search_default_user_id": 1, "project_id": False, "active_id": ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form"),
+              })
+        except:
+            pass
 
 -
-  I Modified the timesheet record.
+  I Modified the timesheet record and make the difference less than 1 hour.
 -
-  !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet.sheet1}:
+  !record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
     timesheet_ids:
       - account_id: account.analytic_sednacom
         date: '05/26/2010'