[FIX] code cleanup (addon hr_evaluation)
improves _appraisal_count method and remove now useless one2many field appraisal_ids bzr revid: ged@openerp.com-20140507090328-wyl9gbfzdc540d1k
This commit is contained in:
parent
ff7ad5e918
commit
943f2d4e4e
|
@ -104,19 +104,15 @@ class hr_employee(osv.Model):
|
||||||
_inherit="hr.employee"
|
_inherit="hr.employee"
|
||||||
|
|
||||||
def _appraisal_count(self, cr, uid, ids, field_name, arg, context=None):
|
def _appraisal_count(self, cr, uid, ids, field_name, arg, context=None):
|
||||||
res = dict(map(lambda x: (x,0), ids))
|
Evaluation = self.pool['hr.evaluation.interview']
|
||||||
try:
|
return {
|
||||||
for employee in self.browse(cr, uid, ids, context=context):
|
employee_id: Evaluation.search_count(cr, uid, [('user_to_review_id', '=', employee_id)], context=context)
|
||||||
res[employee.id] = len(employee.appraisal_ids)
|
for employee_id in ids
|
||||||
except:
|
}
|
||||||
pass
|
|
||||||
return res
|
|
||||||
|
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan'),
|
'evaluation_plan_id': fields.many2one('hr_evaluation.plan', 'Appraisal Plan'),
|
||||||
'evaluation_date': fields.date('Next Appraisal Date', help="The date of the next appraisal is computed by the appraisal plan's dates (first appraisal + periodicity)."),
|
'evaluation_date': fields.date('Next Appraisal Date', help="The date of the next appraisal is computed by the appraisal plan's dates (first appraisal + periodicity)."),
|
||||||
'appraisal_ids': fields.one2many('hr.evaluation.interview', 'user_to_review_id', 'Appraisal Interviews'),
|
|
||||||
'appraisal_count': fields.function(_appraisal_count, type='integer', string='Appraisal Interviews'),
|
'appraisal_count': fields.function(_appraisal_count, type='integer', string='Appraisal Interviews'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue