diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 2f0046ca200..bfb242a5058 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -144,13 +144,13 @@ class hr_job(osv.osv): def action_employee_to_hire(self, cr, uid, id, value, context=None): return self.write(cr, uid, [id], {'no_of_recruitment': value}, context=context) - def job_recruitment(self, cr, uid, ids, *args): + def job_recruitment(self, cr, uid, ids, context=None): for job in self.browse(cr, uid, ids): no_of_recruitment = job.no_of_recruitment == 0 and 1 or job.no_of_recruitment self.write(cr, uid, [job.id], {'state': 'recruit', 'no_of_recruitment': no_of_recruitment}) return True - def job_open(self, cr, uid, ids, *args): + def job_open(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'open', 'no_of_recruitment': 0,'no_of_hired_employee': 0}) return True diff --git a/addons/hr/i18n/hr.pot b/addons/hr/i18n/hr.pot index 7bb34f2ce68..bee35b49346 100644 --- a/addons/hr/i18n/hr.pot +++ b/addons/hr/i18n/hr.pot @@ -162,7 +162,7 @@ msgstr "" #. module: hr #: view:hr.job:0 -msgid "Launch Recruitment" +msgid "Launch Recruitement" msgstr "" #. module: hr @@ -690,7 +690,7 @@ msgstr "" #. module: hr #: selection:hr.job,state:0 -msgid "Recruitment in Progress" +msgid "Recruitement in Progress" msgstr "" #. module: hr diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 3e2e3cbe1b5..387bfbbefc1 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -244,7 +244,8 @@ class hr_applicant(osv.Model): if context is None: context = {} res = super(hr_applicant, self).default_get(cr, uid, fields, context=context) - if context.get('active_id'): + #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 @@ -503,17 +504,8 @@ class hr_job(osv.osv): _name = "hr.job" _inherits = {'mail.alias': 'alias_id'} - def _application_count(self, cr, uid, ids, field_name, arg, context=None): - """Calculate total Applications per job""" - res = dict.fromkeys(ids, 0) - applicant_obj = self.pool.get('hr.applicant') - applicant_ids = applicant_obj.search(cr, uid, [('job_id', 'in', ids)], context=context) - for applicant in applicant_obj.browse(cr, uid, applicant_ids, context=context): - res[applicant.job_id.id] += 1 - return res - def _get_attached_docs(self, cr, uid, ids, field_name, arg, context=None): - """Calculate total attached CV per job""" + """Calculate total attached CV to applications and documents per job""" res = {} attachment_obj = self.pool.get('ir.attachment') for job_id in ids: @@ -526,7 +518,7 @@ class hr_job(osv.osv): 'alias_id': fields.many2one('mail.alias', 'Alias', ondelete="restrict", required=True, help="Email alias for this job position. New emails will automatically " "create new applicants for this job position."), - 'application_count': fields.function(_application_count, type='integer', string="Total Applications"), + 'application_ids': fields.one2many('hr.applicant', 'job_id', 'Applications'), 'manager_id': fields.related('department_id', 'manager_id', type='many2one', string='Department Manager', relation='hr.employee', readonly=True, store=True), 'doc_count':fields.function(_get_attached_docs, string="Number of documents attached", type='int'), 'user_id': fields.many2one('res.users', 'Recruitment Responsible', track_visibility='onchange'), diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index d4b02a1f10f..65c8a151dcb 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -379,11 +379,10 @@ - + - @@ -426,8 +425,8 @@
- Applications - Application + Applications + Application
diff --git a/addons/hr_recruitment/res_config.py b/addons/hr_recruitment/res_config.py index e89378c7866..99b80bf4561 100644 --- a/addons/hr_recruitment/res_config.py +++ b/addons/hr_recruitment/res_config.py @@ -37,6 +37,10 @@ class hr_applicant_settings(osv.osv_memory): 'alias_domain' : fields.char('Alias Domain'), } + _defaults = { + 'alias_domain': lambda self, cr, uid, context:self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context), + } + def get_default_alias_prefix(self, cr, uid, ids, context=None): alias_name = '' mail_alias = self.pool.get('mail.alias') @@ -66,13 +70,3 @@ class hr_applicant_settings(osv.osv_memory): else: mail_alias.create_unique_alias(cr, uid, {'alias_name': record.alias_prefix}, model_name="hr.applicant", context=context) return True - - def get_default_alias_domain(self, cr, uid, ids, context=None): - alias_domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "mail.catchall.domain", context=context) - if not alias_domain: - domain = self.pool.get("ir.config_parameter").get_param(cr, uid, "web.base.url", context=context) - try: - alias_domain = urlparse.urlsplit(domain).netloc.split(':')[0] - except Exception: - pass - return {'alias_domain': alias_domain} diff --git a/addons/hr_recruitment/static/src/js/job_position.js b/addons/hr_recruitment/static/src/js/job_position.js index 40e46a65d60..06e880cb40d 100644 --- a/addons/hr_recruitment/static/src/js/job_position.js +++ b/addons/hr_recruitment/static/src/js/job_position.js @@ -10,5 +10,4 @@ openerp.hr_recruitment = function (openerp) { }, }); - openerp.web_kanban.fields_registry.add("justgage", "openerp.hr_recruitment.GaugeWidget"); } \ No newline at end of file