[FIX]:fixed the hr_evaluation bugs listed on piratepad

bzr revid: pap@tinyerp.co.in-20100701133302-jispx2m532d29dee
This commit is contained in:
pap (openerp) 2010-07-01 19:03:02 +05:30
parent a54e5431f8
commit e32a158b18
2 changed files with 19 additions and 2 deletions

View File

@ -39,6 +39,7 @@ class hr_evaluation_plan(osv.osv):
}
_defaults = {
'active' : lambda *a: 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()
@ -171,7 +172,17 @@ class hr_evaluation(osv.osv):
'date' : lambda *a: (dt.ISO.ParseAny(dt.now().strftime('%Y-%m-%d')) + dt.RelativeDateTime(months =+ 1)).strftime('%Y-%m-%d'),
'state' : lambda *a: 'draft',
}
def name_get(self, cr, uid, ids, context={}):
if not len(ids):
return []
reads = self.browse(cr, uid, ids, context)
res = []
for record in reads:
name = record.plan_id.name
res.append((record['id'], name))
return res
def onchange_employee_id(self, cr, uid, ids, employee_id, context={}):
employee_obj=self.pool.get('hr.employee')
evaluation_plan_id=''
@ -251,6 +262,9 @@ class survey_request(osv.osv):
_columns = {
'is_evaluation':fields.boolean('Is Evaluation?'),
}
_defaults = {
'state': lambda * a: 'waiting_answer',
}
survey_request()
@ -274,12 +288,13 @@ class hr_evaluation_interview(osv.osv):
def survey_req_done(self, cr, uid, ids, context=None):
if context is None:
context = {}
self.write(cr, uid, ids, { 'state' : 'done'})
hr_eval_obj = self.pool.get('hr_evaluation.evaluation')
for id in self.browse(cr, uid, ids, context=context):
flag = False
wating_id = 0
tot_done_req = 0
if not id.evaluation_id.id:
raise osv.except_osv(_('Warning !'),_("You cannot start evaluation without Evaluation type."))
records = hr_eval_obj.browse(cr, uid, [id.evaluation_id.id],context=context)[0].survey_request_ids
for child in records:
if child.state == "draft" :
@ -292,6 +307,7 @@ class hr_evaluation_interview(osv.osv):
if not flag and wating_id:
self.survey_req_waiting_answer(cr, uid, [wating_id], context)
hr_eval_obj.write(cr, uid, [id.evaluation_id.id], {'progress' :tot_done_req * 100 / len(records)}, context=context)
self.write(cr, uid, ids, { 'state' : 'done'})
return True
def survey_req_draft(self, cr, uid, ids, context={}):

View File

@ -291,6 +291,7 @@
<form string="Interview Evaluation">
<group col="4" colspan="4">
<field name="survey_id"/>
<field name="evaluation_id"/>
<group col="2" colspan="2">
<button name="%(survey.action_view_survey_question_message)d" string="Interview Question" type="action" states="waiting_answer,done,cancel"
icon="gtk-execute" context="{'survey_id': survey_id, 'response_id': [response], 'response_no':0, 'active' : response,'request' : True, 'object' : 'hr.evaluation.interview', 'cur_id' : active_id}" attrs="{'readonly':[('survey_id','=',False)]}"/>