Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
3501 Widoki

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 

Awatar
Odrzuć
Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
7
mar 25
7530
3
maj 24
4302
3
lis 24
44510
1
kwi 23
4477
7
kwi 23
18521