Code Improve.
bzr revid: jir@tinyerp.com-20130611094005-tu13lpz6u837va0s
This commit is contained in:
parent
726e902dee
commit
959445fa69
|
@ -199,9 +199,6 @@
|
|||
<xpath expr="//filter[@name='my_documents_filter']" position="replace">
|
||||
<filter name="my_documents_filter" string="My Document(s)" icon="terp-personal" domain="[('user_id','=',uid)]" help="Filter on my documents"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='name']" position="replace">
|
||||
<field name="name" filter_domain="['|','|',('name', 'ilike', self), ('datas_fname', 'ilike', self),('index_content', 'ilike', self)]" string="Attachment"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='create_uid']" position="replace">
|
||||
<field name="user_id"/>
|
||||
<field name="parent_id" />
|
||||
|
|
|
@ -29,20 +29,30 @@ from openerp.tools import html2plaintext
|
|||
class applicant_document(osv.osv):
|
||||
_name = 'hr.applicant'
|
||||
_inherit = 'hr.applicant'
|
||||
|
||||
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)])
|
||||
for applicant in self.browse(cr, uid, ids, context=context):
|
||||
res[applicant.id] = 0
|
||||
attach_id = attachment_pool.search(cr, uid, [('res_model','=','hr.applicant'),('res_id','=',applicant.id)])
|
||||
if attach_id:
|
||||
for attach in attachment_pool.browse(cr, uid, attach_id, context):
|
||||
res[issue.id] = attach.index_content
|
||||
res[applicant.id] = attach.index_content
|
||||
return res
|
||||
|
||||
def _content_search(self, cursor, user, obj, name, args, context=None):
|
||||
record_ids = []
|
||||
attachment_pool = self.pool.get('ir.attachment')
|
||||
args += [('res_model','=','hr.applicant')]
|
||||
attach_ids = attachment_pool.search(cursor, user, args)
|
||||
for attach in attachment_pool.browse(cursor, user, attach_ids):
|
||||
record_ids.append(attach.res_id)
|
||||
return [('id', 'in', record_ids)]
|
||||
|
||||
_columns = {
|
||||
'index_content': fields.function(_get_index_content, string='Index Content', \
|
||||
type="char",store=True),
|
||||
fnct_search=_content_search,type="text"),
|
||||
}
|
||||
applicant_document()
|
||||
|
||||
|
|
|
@ -2,27 +2,17 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="crm_case_tree_view_job_inherit">
|
||||
<field name="name">Applicants</field>
|
||||
<field name="model">hr.applicant</field>
|
||||
<field name="inherit_id" ref="hr_recruitment.crm_case_tree_view_job" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="user_id" position="after">
|
||||
<field name="index_content" invisible="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_crm_case_jobs_filter_inherit" model="ir.ui.view">
|
||||
<field name="name">Jobs - Recruitment Search</field>
|
||||
<field name="model">hr.applicant</field>
|
||||
<field name="inherit_id" ref="hr_recruitment.view_crm_case_jobs_filter" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="job_id" position="before">
|
||||
<field name="index_content" string="Resume Content"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_crm_case_jobs_filter_inherit" model="ir.ui.view">
|
||||
<field name="name">Jobs - Recruitment Search</field>
|
||||
<field name="model">hr.applicant</field>
|
||||
<field name="inherit_id" ref="hr_recruitment.view_crm_case_jobs_filter" />
|
||||
<field name="arch" type="xml">
|
||||
<field name="job_id" position="before">
|
||||
<field name="index_content" string="Resume Content"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="hr_applicant_resumes">
|
||||
|
|
Loading…
Reference in New Issue