[IMP] improved code to show default alias id
bzr revid: tpa@tinyerp.com-20140210131609-v5cxl5pexk37pt6d
This commit is contained in:
@@ -240,6 +240,16 @@ class hr_applicant(osv.Model):
|
||||
'stage_id': _read_group_stage_ids
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
res = super(hr_applicant, self).default_get(cr, uid, fields, context=context)
|
||||
#NOTE:to set default user_id in applicant if applicant directly created from kanban action of job because currently web is not parsing value in context on action.
|
||||
if context.get('active_model') == "hr.job" and context.get('active_id'):
|
||||
job = self.pool.get('hr.job').browse(cr, uid, context.get('active_id'), context=context)
|
||||
res.update({'user_id': job.user_id.id})
|
||||
return res
|
||||
|
||||
def onchange_job(self, cr, uid, ids, job_id=False, context=None):
|
||||
department_id = False
|
||||
if job_id:
|
||||
@@ -553,13 +563,6 @@ class hr_job(osv.osv):
|
||||
'nodestroy': True,
|
||||
}
|
||||
|
||||
def open_applicants(self, cr, uid, ids, context=None):
|
||||
model, action_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'hr_recruitment','action_hr_job_applications')
|
||||
action = self.pool.get(model).read(cr, uid, action_id, context=context)
|
||||
job = self.browse(cr, uid, ids[0], context=context)
|
||||
action['context'] = str({'search_default_job_id': [job.id], 'default_job_id': job.id, 'default_user_id': job.user_id.id})
|
||||
return action
|
||||
|
||||
def open_attachments(self, cr, uid, ids, context=None):
|
||||
#open attachments of job and related applicantions.
|
||||
model, action_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base','action_attachment')
|
||||
|
||||
@@ -495,6 +495,7 @@
|
||||
<field name="alias_name">jobs</field>
|
||||
<field name="alias_model_id" ref="model_hr_applicant"/>
|
||||
<field name="alias_user_id" ref="base.user_root"/>
|
||||
<field name="alias_parent_model_id" ref="model_hr_job"/>
|
||||
</record>
|
||||
|
||||
<!-- Applicant-related subtypes for messaging / Chatter -->
|
||||
|
||||
@@ -313,7 +313,7 @@
|
||||
<field name="name">Applications</field>
|
||||
<field name="res_model">hr.applicant</field>
|
||||
<field name="view_mode">kanban,tree,form,graph,calendar</field>
|
||||
<field name="context">{'search_default_job_id': [active_id], 'default_job_id': active_id}</field>
|
||||
<field name="context">{'search_default_job_id': [active_id], 'default_job_id': active_id, 'empty_list_help_model': 'hr.job'}</field>
|
||||
<field name="help" type="html">
|
||||
<p>
|
||||
OpenERP helps you track applicants in the recruitment
|
||||
@@ -430,7 +430,7 @@
|
||||
</div>
|
||||
<t t-if="record.state.raw_value == 'recruit'">
|
||||
<div class="oe_applications">
|
||||
<a name="open_applicants" type="object">
|
||||
<a name="%(action_hr_job_applications)d" type="action">
|
||||
<span t-if="record.application_ids.raw_value.length gt 1"><t t-esc="record.application_ids.raw_value.length"/> Applications</span>
|
||||
<span t-if="record.application_ids.raw_value.length lt 2"><t t-esc="record.application_ids.raw_value.length"/> Application</span>
|
||||
</a>
|
||||
|
||||
@@ -115,7 +115,7 @@ class mail_thread(osv.AbstractModel):
|
||||
alias = object_id.alias_id
|
||||
if catchall_domain and model and not alias: #check for example alias if res_id not given or given res_id dose not contain alias-> generic help message, take an example alias (i.e. alias of some section_id)
|
||||
alias_obj = self.pool.get('mail.alias')
|
||||
alias_ids = alias_obj.search(cr, uid, [("alias_parent_model_id.model", "=", model), ("alias_name", "!=", False), ('alias_force_thread_id', '=', False)], context=context, order='id ASC')
|
||||
alias_ids = alias_obj.search(cr, uid, [("alias_parent_model_id.model", "=", model), ("alias_name", "!=", False), ('alias_force_thread_id', '=', False), ('alias_parent_thread_id', '=', False)], context=context, order='id ASC')
|
||||
if alias_ids and len(alias_ids) == 1:
|
||||
alias = alias_obj.browse(cr, uid, alias_ids[0], context=context)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user