diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 8e899186cfa..8491ca39312 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -74,14 +74,11 @@ class hr_job(osv.osv): def _no_of_employee(self, cr, uid, ids, name, args, context=None): res = {} - applicant_obj = self.pool.get('hr.applicant') for job in self.browse(cr, uid, ids, context=context): nb_employees = len(job.employee_ids or []) - job_ids = len(applicant_obj.search(cr, uid, [('job_id', '=', job.id)], context=context)) res[job.id] = { 'no_of_employee': nb_employees, 'expected_employees': nb_employees + job.no_of_recruitment, - 'no_of_application':job_ids } return res @@ -108,9 +105,6 @@ class hr_job(osv.osv): 'hr.employee': (_get_job_position, ['job_id'], 10), }, multi='no_of_employee'), - 'no_of_application': fields.function(_no_of_employee, type="integer" ,string='Total Number of Application', - help='Expected number of employees for this job position after new recruitment.', - multi='no_of_employee'), 'no_of_employee': fields.function(_no_of_employee, string="Current Number of Employees", help='Number of employees currently occupying this job position.', store = { diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 8098e4b1ecb..6ac8d7cf4dd 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -492,6 +492,30 @@ class hr_job(osv.osv): _name = "hr.job" _inherits = {'mail.alias': 'alias_id'} + def _count_priority(self, cr, uid, ids, name, args, context=None): + """Applicant, priority count like number of star 3,2,1(star rating) + """ + applicant_obj = self.pool.get('hr.applicant') + res = {} + for position in self.browse(cr, uid, ids, context=context): + res[position.id] = {} + priority1 = 0 + priority2 = 0 + priority3 = 0 + rate_ids = applicant_obj.search(cr, uid, [('job_id', '=', position.id)], context=context) + for applicant in applicant_obj.browse(cr, uid, rate_ids, context=context): + if applicant.job_id.id == position.id: + if applicant.priority == '3': + priority3 += 1 + elif applicant.priority == '2': + priority2 += 1 + elif applicant.priority == '1': + priority1 += 1 + else: + pass + res[position.id] = {'priority1': priority1, 'priority2': priority2, 'priority3': priority3, 'total_application':len(rate_ids)} + return res + def _get_department_mgr(self, cr, uid, ids, name, args, context=None): """Get manager image for specific job position. """ @@ -511,6 +535,7 @@ class hr_job(osv.osv): 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="cascade", required=True, help="Email alias for this job position. New emails will automatically " "create new applicants for this job position."), + 'priority_count': fields.function(_count_priority, string='Total Priority Employees', type="char"), 'manager_id': fields.function(_get_department_mgr, string='Department Manager', type="char"),#manager image in kanban } _defaults = { diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index c20fabea9d8..96ddd2e9e4e 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -303,12 +303,10 @@ -