跳至內容
選單
此問題已被標幟
1 回覆
3087 瀏覽次數

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')
頭像
捨棄
最佳答案

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')
頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
7月 24
997
2
6月 22
3435
1
8月 21
4848
4
10月 20
4050
1
5月 24
4031