[IMP] improved message and code

bzr revid: tpa@tinyerp.com-20131210122930-zfkbyok26pg91e1q
This commit is contained in:
Turkesh Patel (Open ERP) 2013-12-10 17:59:30 +05:30
parent df95f376be
commit 51f0183b27
1 changed files with 4 additions and 3 deletions

View File

@ -366,7 +366,7 @@ class hr_applicant(osv.Model):
if vals.get('department_id') and not context.get('default_department_id'):
context['default_department_id'] = vals.get('department_id')
if vals.get('job_id'):
self.pool['hr.job'].message_post(cr, uid, [vals['job_id']], body=_('New Applicant %s <b>Created</b>') % vals['name'], subtype="hr_recruitment.mt_applicant_new", context=context)
self.pool['hr.job'].message_post(cr, uid, [vals['job_id']], body=_('New Applicant %s Created') % vals['name'], subtype="hr_recruitment.mt_applicant_new", context=context)
obj_id = super(hr_applicant, self).create(cr, uid, vals, context=context)
return obj_id
@ -384,7 +384,8 @@ class hr_applicant(osv.Model):
res = super(hr_applicant, self).write(cr, uid, [applicant.id], vals, context=context)
return res
if vals.get('job_id'):
self.pool['hr.job'].message_post(cr, uid, [vals['job_id']], body=_('New Applicant %s <b>Created</b>') % vals['name'], subtype="hr_recruitment.mt_applicant_new", context=context)
for applicant in self.browse(cr, uid, ids, context=None):
self.pool['hr.job'].message_post(cr, uid, [vals['job_id']], body=_('New Applicant %s Created') % applicant.name, subtype="hr_recruitment.mt_applicant_new", context=context)
return super(hr_applicant, self).write(cr, uid, ids, vals, context=context)
def create_employee_from_applicant(self, cr, uid, ids, context=None):
@ -408,7 +409,7 @@ class hr_applicant(osv.Model):
'department_id': applicant.department_id.id
})
self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context)
self.pool['hr.job'].message_post(cr, uid, [applicant.job_id.id], body=_('New Employee %s <b>Hired</b>') % applicant.partner_name, subtype="hr_recruitment.mt_applicant_employee", context=context)
self.pool['hr.job'].message_post(cr, uid, [applicant.job_id.id], body=_('New Employee %s Hired') % applicant.partner_name, subtype="hr_recruitment.mt_applicant_employee", context=context)
else:
raise osv.except_osv(_('Warning!'), _('You must define an Applied Job and a Contact Name for this applicant.'))