hi all , iam trying to override the create method of hr.employee , what iam trying to odoo is when i create a employee it should create a contact record too both at same time . please check my code below tell me what i did wrong there
class ResPartnerInherit(models.Model):
_inherit = 'hr.employee'
@api.model
def create(self, vals):
res = super(ResPartnerInherit, self).create(vals)
pdb.set_trace()
if vals['name']:
vals= self.env['res.partner'].create({'name':vals['name']})
return res
@api.model
def create(self, vals):
res = super(ResPartnerInherit, self).create(vals)
pdb.set_trace()
#if vals['name']:
#if self.name:
if vals.get('name'):
#vals = self.env['res.partner'].create({'name':vals['name']})
vals = self.env['res.partner'].create({'name': self.name})
return res
i even tried like this seems like the prob is here if vals['name']: