Skip to Content
Menu
This question has been flagged
1 Reply
2166 Views

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
Discard
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
Discard
Related Posts Replies Views Activity
1
Jul 24
213
2
Jun 22
2189
1
Aug 21
3664
4
Oct 20
2972
1
May 24
2905