From 50082c1160a852315e14e07c097560b55f321c39 Mon Sep 17 00:00:00 2001 From: "Vishmita Jadeja (openerp)" Date: Thu, 9 May 2013 14:52:52 +0530 Subject: [PATCH 1/3] [IMP]Improve code for interview link and add field no_of_application in job position form bzr revid: vja@tinyerp.com-20130509092252-e26nsd25vwugrtrw --- addons/hr/hr.py | 6 +++++ addons/hr_recruitment/hr_recruitment.py | 25 ------------------- addons/hr_recruitment/hr_recruitment_view.xml | 25 ++++++++++++++++--- .../static/src/css/job_position.css | 6 +++++ 4 files changed, 33 insertions(+), 29 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 8491ca39312..8e899186cfa 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -74,11 +74,14 @@ 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 @@ -105,6 +108,9 @@ 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 6ac8d7cf4dd..8098e4b1ecb 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -492,30 +492,6 @@ 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. """ @@ -535,7 +511,6 @@ 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 96ddd2e9e4e..c20fabea9d8 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -303,10 +303,12 @@ +