Skip to Content
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odgovori
3104 Prikazi

I have two model, when I change one model another one will change automatically.

class ModelA(models.Model):
    _name = 'res.partner'
    user_id = fields.Many2one('res.users',string='Sales Person')
    
class ModelB(models.Model):
    _name = 'res.users'
    agent_id = fields.Many2one('res.users', string='Ref Agent')
Avatar
Opusti
Best Answer

You can try related field .

class ModelA(models.Model):
    _name = 'res.partner'
    user_id = fields.Many2one('res.users',string='Sales Person')
    
class ModelB(models.Model):
    _name = 'res.users'
    agent_id = fields.Many2one("res.users", "Ref Agent", related='partner_id.user_id')
Avatar
Opusti
Related Posts Odgovori Prikazi Aktivnost
1
jul. 24
1005
2
jun. 22
3448
1
avg. 21
4889
4
okt. 20
4062
1
maj 24
4037