From ee471832f9d9a3eae6260bd0ba95951321bbb874 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 10 Feb 2014 18:46:09 +0530 Subject: [PATCH] [IMP] improved code to show default alias id bzr revid: tpa@tinyerp.com-20140210131609-v5cxl5pexk37pt6d --- addons/hr_recruitment/hr_recruitment.py | 17 ++++++++++------- addons/hr_recruitment/hr_recruitment_data.xml | 1 + addons/hr_recruitment/hr_recruitment_view.xml | 4 ++-- addons/mail/mail_thread.py | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 97fc2eeba3f..bcb71040a8a 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -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') diff --git a/addons/hr_recruitment/hr_recruitment_data.xml b/addons/hr_recruitment/hr_recruitment_data.xml index 0a259b7e4c4..0a8935cac2b 100644 --- a/addons/hr_recruitment/hr_recruitment_data.xml +++ b/addons/hr_recruitment/hr_recruitment_data.xml @@ -495,6 +495,7 @@ jobs + diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 26229a3e542..637913127ae 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -313,7 +313,7 @@ Applications hr.applicant kanban,tree,form,graph,calendar - {'search_default_job_id': [active_id], 'default_job_id': active_id} + {'search_default_job_id': [active_id], 'default_job_id': active_id, 'empty_list_help_model': 'hr.job'}

OpenERP helps you track applicants in the recruitment @@ -430,7 +430,7 @@

- + Applications Application diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index d338a134c16..ec813455898 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -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)