I am create module cal salesman
1. i created model
salesman.py
class Salesman(models.Model):
_name = 'smartsales.salesman'
_description ='Salesman'
_inherit = 'mail.thread'
salesname = fields.Many2one('res.users', string='Name', defalut=lambda self: self.env.uid)
companyname = fields.Char(string='Companyname')
@api.onchange('salesname.company_id','companyname')
def update_company(self):
self.companyname = self.salesname.company_id
view
<field name="salesname" />
<field name="companyname" on_change="0" readonly="1"/>
I want to create dropdownlist that when i select user and it will show companyname of user
how can i do it ?
companyname = fields.Many2one('res.company', string='Companyname')
@api.onchange('salesname')
def update_company(self):
self.companyname = self.salesname.company_id.id
thank you Niyas Raphy