This question has been flagged
1 Reply
3489 Views

I used the following code to create job position but I was unsuccessful because of the mail.alias object that it is inherited it


job = {'name':'System Engineer'} 

job = self.pool.get('hr.job').create(cr, uid, job, context=context)

Any help

Avatar
Discard
Best Answer

May be this will helpful to you.

    def create(self, cr, uid, vals, context=None):
alias_context = dict(context, alias_model_name='hr.applicant', alias_parent_model_name=self._name)
job_id = super(hr_job, self).create(cr, uid, vals, context=alias_context)
job = self.browse(cr, uid, job_id, context=context)
self.pool.get('mail.alias').write(cr, uid, [job.alias_id.id], {'alias_parent_thread_id': job_id, "alias_defaults": {'job_id': job_id}}, context)
return job_id
Avatar
Discard