}
- class hr_employee(osv.osv):
+ class hr_employee(osv.Model):
_name = "hr.employee"
- _inherit = "hr.employee"
+ _inherit="hr.employee"
+
+ def _appraisal_count(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,0), ids))
+ try:
+ for employee in self.browse(cr, uid, ids, context=context):
+ res[employee.id] = len(employee.appraisal_ids)
+ except:
+ pass
+ return res
+
+
_columns = {
'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)."),
+ 'appraisal_ids': fields.one2many('hr.evaluation.interview', 'user_to_review_id', 'Appraisal Interviews'),
+ 'appraisal_count': fields.function(_appraisal_count, type='integer', string='Appraisal Interviews'),
}
- def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
+ def run_employee_evaluation(self, cr, uid, automatic=False, use_new_cursor=False, context=None): # cronjob
now = parser.parse(datetime.now().strftime('%Y-%m-%d'))
obj_evaluation = self.pool.get('hr_evaluation.evaluation')
- emp_ids =self.search(cr, uid, [ ('evaluation_plan_id','<>',False), ('evaluation_date','=', False)], context=context)
+ emp_ids = self.search(cr, uid, [('evaluation_plan_id', '<>', False), ('evaluation_date', '=', False)], context=context)
for emp in self.browse(cr, uid, emp_ids, context=context):
- first_date = (now+ relativedelta(months=emp.evaluation_plan_id.month_first)).strftime('%Y-%m-%d')
+ first_date = (now + relativedelta(months=emp.evaluation_plan_id.month_first)).strftime('%Y-%m-%d')
self.write(cr, uid, [emp.id], {'evaluation_date': first_date}, context=context)
- emp_ids =self.search(cr, uid, [
- ('evaluation_plan_id','<>',False), ('evaluation_date','<=', time.strftime("%Y-%m-%d")),
- ], context=context)
+ emp_ids = self.search(cr, uid, [('evaluation_plan_id', '<>', False), ('evaluation_date', '<=', time.strftime("%Y-%m-%d"))], context=context)
for emp in self.browse(cr, uid, emp_ids, context=context):
next_date = (now + relativedelta(months=emp.evaluation_plan_id.month_next)).strftime('%Y-%m-%d')
self.write(cr, uid, [emp.id], {'evaluation_date': next_date}, context=context)
], context=context)
return res
+ def _count_all(self, cr, uid, ids, field_name, arg, context=None):
+ res = dict(map(lambda x: (x,{'documents_count': 0, 'application_count': 0,}), ids))
+ try:
+ for job in self.browse(cr, uid, ids, context=context):
+ res[job.id] = {'documents_count': len(job.document_ids),
+ 'application_count': len(job.applicant_ids),
+ }
+ except:
+ pass
+ return res
+
_columns = {
- 'survey_id': fields.many2one('survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
+ 'survey_id': fields.many2one('survey.survey', 'Interview Form', help="Choose an interview form for this job position and you will be able to print/answer this interview from all applicants who apply for this job"),
'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True,
help="Email alias for this job position. New emails will automatically "
"create new applicants for this job position."),
</header>
<sheet>
<div class="oe_right oe_button_box">
- <button name="action_makeMeeting" type="object"
- string="Schedule Meeting" help="Schedule interview with this applicant"/>
- <button name="action_start_survey" type="object"
- string="Start Interview" help="Answer related job question"
+ <button name="action_makeMeeting" class="oe_stat_button" icon="fa-calendar" type="object"
+ help="Schedule interview with this applicant">
+ <div>Schedule<br/>Meeting</div>
+ </button>
- <button name="%(survey.action_view_survey_question_message)d"
++ <button name="action_start_survey"
+ class="oe_stat_button"
+ icon="fa-user"
- type="action"
++ type="object"
+ help="Answer related job question"
- context="{'survey_id': survey, 'response_id': [response], 'response_no':0 ,'active' : response, 'object' : 'hr.applicant'}"
+ context="{'survey_id': survey}"
- attrs="{'invisible':[('survey','=',False)]}"/>
- <button name="action_print_survey" type="object"
- string="Print Interview" help="Print interview report"
- attrs="{'invisible':[('survey','=',False)]}"/>
- <button name="action_get_attachment_tree_view" string="Documents" type="object"/>
+ attrs="{'invisible':[('survey','=',False)]}">
+ <div>Start<br/>Interview</div>
+ </button>
+ <button name="action_print_survey"
+ class="oe_stat_button"
+ icon="fa-print"
+ type="object"
+ help="Print interview report"
+ attrs="{'invisible':[('survey','=',False)]}">
+ <div>Print<br/>Interview</div>
+ </button>
+ <button name="action_get_attachment_tree_view"
+ class="oe_stat_button"
+ icon="fa-book"
+ type="object">
+ <field name="attachment_number" widget="statinfo" string="Documents"/>
+ </button>
</div>
<div class="oe_title">
<label for="name" class="oe_edit_only"/>