From 09df39578dbdab58dec156a3c171b59a731ab849 Mon Sep 17 00:00:00 2001 From: "Dharti Ratani (Open ERP)" Date: Thu, 14 Mar 2013 17:01:16 +0530 Subject: [PATCH] [IMP]Search within the content of the resume in the search view of an applicant, bzr revid: dhr@tinyerp.com-20130314113116-lh4v21bm0mt4d9lc --- addons/hr_recruitment/hr_recruitment.py | 13 +++++++++++++ addons/hr_recruitment/hr_recruitment_view.xml | 2 ++ 2 files changed, 15 insertions(+) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 3c074b4e1ad..c27f97c27df 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -195,6 +195,17 @@ class hr_applicant(base_stage, osv.Model): res[issue.id] = len(attach) return res + def _get_index_content(self, cr, uid, ids, fields, args, context=None): + res = {} + attachment_pool = self.pool.get('ir.attachment') + for issue in self.browse(cr, uid, ids, context=context): + res[issue.id] = 0 + attach_id = attachment_pool.search(cr, uid, [('res_model','=','hr.applicant'),('res_id','=',issue.id)]) + if attach_id: + for attach in attachment_pool.browse(cr, uid, attach_id, context): + res[issue.id] = attach.index_content + return res + _columns = { 'name': fields.char('Subject', size=128, required=True), 'active': fields.boolean('Active', help="If the active field is set to false, it will allow you to hide the case without removing it."), @@ -247,6 +258,8 @@ class hr_applicant(base_stage, osv.Model): 'emp_id': fields.many2one('hr.employee', 'employee'), 'attachments': fields.function(_compute_attachments, string='Attachments', \ type="integer"), + 'index_content': fields.function(_get_index_content, string='Index Content', \ + type="char",store=True), 'user_email': fields.related('user_id', 'email', type='char', string='User Email', readonly=True), } diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 89843a3b801..40c2e7112f2 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -58,6 +58,7 @@ + @@ -185,6 +186,7 @@ +