From 300eea6300757a4e16d59aaad6e41d0c62df7a44 Mon Sep 17 00:00:00 2001 From: "PSI(OpenERP)" <> Date: Fri, 20 Aug 2010 17:00:54 +0530 Subject: [PATCH] [IMP] hr improvements bzr revid: mra@mra-laptop-20100820113054-mayxce6dsf6b316n --- addons/hr/hr_department_view.xml | 2 +- .../wizard/hr_attendance_bymonth_view.xml | 4 +- addons/hr_evaluation/hr_evaluation.py | 12 +-- addons/hr_holidays/hr_holidays_demo.xml | 84 +++++++++---------- .../test/test_hr_timesheet_sheet.yml | 34 +++++--- 5 files changed, 73 insertions(+), 63 deletions(-) diff --git a/addons/hr/hr_department_view.xml b/addons/hr/hr_department_view.xml index 1b96956394f..c2bb6ac7390 100644 --- a/addons/hr/hr_department_view.xml +++ b/addons/hr/hr_department_view.xml @@ -76,7 +76,7 @@ - + res.users.form diff --git a/addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml b/addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml index 8d3aa343b15..e9b5fecf330 100644 --- a/addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml +++ b/addons/hr_attendance/wizard/hr_attendance_bymonth_view.xml @@ -19,7 +19,7 @@ - Attendances by month + Attendances By Month ir.actions.act_window hr.attendance.month form @@ -30,7 +30,7 @@ - Attendances by month + Attendances By Month client_print_multi action diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index b4743a7ffdc..0b497c461e0 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -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: diff --git a/addons/hr_holidays/hr_holidays_demo.xml b/addons/hr_holidays/hr_holidays_demo.xml index 2ea95b76620..bfa051dff7a 100644 --- a/addons/hr_holidays/hr_holidays_demo.xml +++ b/addons/hr_holidays/hr_holidays_demo.xml @@ -1,52 +1,52 @@ - + - - - Casual Leave - True - black - + + + Casual Leave + True + black + - - Casual Leave for Fabien Pinckaers - - add - 12 - - + + Casual Leave for Fabien Pinckaers + + add + 12 + + - - Trip with Family - - 2010-01-04 08:00 - 2010-01-06 18:00 - remove - 3 - - + + Trip with Family + + + + remove + 3 + + - - - Sick Leave - True - red - + + + Sick Leave + True + red + - - Doctor Appointment - - 2010-02-01 00:00 - 2010-02-03 08:00 - remove - draft - 3 - - + + Doctor Appointment + + + + remove + draft + 3 + + - - + + - + diff --git a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml index 1486d7f9bb4..d75968f5f16 100644 --- a/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml +++ b/addons/hr_timesheet_sheet/test/test_hr_timesheet_sheet.yml @@ -9,6 +9,15 @@ partner_id: base.res_partner_desertic_hispafuentes 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”. - @@ -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' @@ -98,20 +107,21 @@ 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'