class LmcPhone(models.Model):
_name = 'lmc.phone'
partner_phone = fields.Char(string="Phone")
partner_mobile = fields.Char(string="Mobile")
email = fields.Char()
#add phone,email,mobile in res.partner in create method.
@api.model
def create(self, vals):
if vals['partner_id']:
record_set_partner = self.env['res.partner'].browse(vals['partner_id'])
record_set_partner.email = vals['email']
record_set_partner.phone = vals['partner_phone']
record_set_partner.mobile = vals['partner_mobile']
result = super(LmcPhone, self).create(vals)
return result
Notes
How to add email,phone,mobile in res.partner in write method(Edit mode)?Thanks in advance.Please help how to get the answer.
I am sorry for adding partner_id in question
partner_id = fields.Many2one('res.partner', string="Client")
dear juan
i don't get the correct answer using this method. i think it's need to override the write method.