From 28fc9eff481298efcf7c923835acad4580dab34f Mon Sep 17 00:00:00 2001 From: "YSA(OpenERP),APA(OpenERP)" <> Date: Wed, 3 Mar 2010 19:12:00 +0530 Subject: [PATCH] [IMP]:survey,hr_evaluation:Improved survey with Evaluation request. bzr revid: apa@tinyerp.com-20100303134200-d8dj6ajyprpj2c1v --- addons/hr_evaluation/hr_evaluation.py | 36 +++++++++-- addons/hr_evaluation/hr_evaluation_data.xml | 12 +++- addons/hr_evaluation/hr_evaluation_view.xml | 71 +++++++++++++++++++-- addons/survey/survey.py | 2 +- addons/survey/survey_view.xml | 2 +- 5 files changed, 109 insertions(+), 14 deletions(-) diff --git a/addons/hr_evaluation/hr_evaluation.py b/addons/hr_evaluation/hr_evaluation.py index 41056d70dbc..2166fab0093 100644 --- a/addons/hr_evaluation/hr_evaluation.py +++ b/addons/hr_evaluation/hr_evaluation.py @@ -21,6 +21,7 @@ import time from osv import fields, osv +from mx import DateTime as dt class hr_evaluation_plan(osv.osv): _name = "hr_evaluation.plan" @@ -75,13 +76,36 @@ class hr_employee(osv.osv): _inherit="hr.employee" _columns = { 'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Evaluation Plan'), - 'evaluation_date': fields.date('Next Evaluation', help="Date of the next evaluation"), + 'evaluation_date': fields.date('Next Evaluation', help="Date of the next evaluation",readonly=True), } - def onchange_evaluation_plan_id(self, *args): - # return the right evaluation date - pass + + def onchange_evaluation_plan_id(self,cr,uid,ids,evaluation_plan_id,context={}): + evaluation_date = self.browse(cr, uid, ids)[0].evaluation_date or '' + evaluation_plan_obj=self.pool.get('hr_evaluation.plan') + if evaluation_plan_id: + for evaluation_plan in evaluation_plan_obj.browse(cr,uid,[evaluation_plan_id]): + if not evaluation_date: + evaluation_date=(dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d'))+ dt.RelativeDateTime(months=+evaluation_plan.month_first)).strftime('%Y-%m-%d') + else: + evaluation_date=(dt.ISO.ParseAny(evaluation_date)+ dt.RelativeDateTime(months=+evaluation_plan.month_next)).strftime('%Y-%m-%d') + return {'value': {'evaluation_date':evaluation_date}} hr_employee() +class hr_evaluation_interview(osv.osv): + _name = "hr.evaluation.interview" + _inherit = "survey.request" + + def default_get(self, cr, uid, fields, context={}): + data = super(hr_evaluation_interview, self).default_get(cr, uid, fields, context) + if context.has_key('phase_id'): + data['survey_id'] =self.pool.get('hr_evaluation.plan.phase').browse(cr, uid, context['phase_id']).survey_id.id + return data + + _columns = { + 'user_to_review_id': fields.many2one('hr.employee', 'Employee'), + } +hr_evaluation_interview() + class hr_evaluation(osv.osv): _name = "hr_evaluation.evaluation" _description = "Employee Evaluation" @@ -89,7 +113,6 @@ class hr_evaluation(osv.osv): _columns = { 'date': fields.date("Evaluation Deadline", required=True), 'employee_id': fields.many2one('hr.employee', "Employee", required=True), - 'manager_id': fields.many2one('res.users', "Manager", required=True), 'note_summary': fields.text('Evaluation Summary'), 'note_action': fields.text('Action Plan', help="If the evaluation does not meet the expectations, you can propose"+ @@ -101,7 +124,7 @@ class hr_evaluation(osv.osv): ('3','Exceeds expectations'), ('4','Significantly exceeds expectations'), ], "Overall Rating", help="This is the overall rating on that summarize the evaluation"), - 'survey_request_ids': fields.many2many('survey.request', + 'survey_request_ids': fields.many2many('hr.evaluation.interview', 'hr_evaluation_evaluation_requests', 'evaluation_id', 'survey_id', @@ -139,4 +162,3 @@ class hr_evaluation(osv.osv): hr_evaluation() - diff --git a/addons/hr_evaluation/hr_evaluation_data.xml b/addons/hr_evaluation/hr_evaluation_data.xml index 3e0b6137c7d..372b40a95f7 100644 --- a/addons/hr_evaluation/hr_evaluation_data.xml +++ b/addons/hr_evaluation/hr_evaluation_data.xml @@ -1577,13 +1577,23 @@ Once the form had been filled, the employee send it to his supervisor. + + + + waiting_answer + + + fp@tinyerp.com + 2010-02-21 + + 0 draft - + 2010-01-21 diff --git a/addons/hr_evaluation/hr_evaluation_view.xml b/addons/hr_evaluation/hr_evaluation_view.xml index 58aa5f4a3fc..0a288e34078 100644 --- a/addons/hr_evaluation/hr_evaluation_view.xml +++ b/addons/hr_evaluation/hr_evaluation_view.xml @@ -106,7 +106,7 @@ - + @@ -123,13 +123,12 @@ - - + @@ -169,7 +168,6 @@ - @@ -182,5 +180,70 @@ name="Evaluation" parent="menu_eval_hr" id="menu_open_view_hr_evaluation_tree" action="open_view_hr_evaluation_tree"/> + + + + hr_evaluation.interview.form + hr.evaluation.interview + form + +
+ + + +