跳至内容
菜单
此问题已终结
1 回复
3458 查看

for example i have three model one is master & two is detail models 

Model A

Model B

Model C

Model A is master Model B & Model C is detail 

i hav filed in Model B type when i change type then i want to apply domain on Model C 
how i can do this any help 

形象
丢弃
最佳答案

Hi Usman,

Try following Code

class MasterClass(models.Model):
        _name = 'master.class'

         o2m_f1 = fields.One2Many('o2m.table1', 'field')
         o2m_f2 = fields.One2Many('o2m.table2', 'field')

Class O2mTable1(models.Model):
         _name = 'o2m.table1'

         name = fields.Char()
         field = fields.Many2one('master.class')

         @api.onchange('name')
         def trigger_o2m_change():
                # Your Function Info.


Class O2mTable2(models.Model):
         _name = 'o2m.table2'

         name = fields.Char()
         field = fields.Many2one('master.class')

         @api.onchange('name')
         def trigger_o2m_change():
            # Your Function Info.

Thanks

形象
丢弃
相关帖文 回复 查看 活动
7
3月 25
7266
3
5月 24
4244
3
11月 24
44462
1
4月 23
4438
7
4月 23
18496