Skip to Content
Menu
This question has been flagged
1 Atsakyti
3506 Rodiniai

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 

Portretas
Atmesti
Best Answer

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

Portretas
Atmesti
Related Posts Replies Rodiniai Veikla
7
kov. 25
7534
3
geg. 24
4302
3
lapkr. 24
44510
1
bal. 23
4477
7
bal. 23
18521