Skip to Content
Menu
This question has been flagged
1045 Views

Is it possible to have a common form to create a child model depending on the field "child_type" selected?

classParent(models.Model):
  _name = 'parent'  
    child_type= fields.Selection(['childA', 'childB'], 'Type') 

classChildA(models.Model):
  _name = 'childA'
  _inherits = {'parent': 'parent_id'}  
    fieldA = fields.Char('FieldA', required=True)

class ChildB(models.Model):
  _name = 'childB'
  _inherits = {'parent': 'parent_id'}  
    fieldB = fields.Char('FieldB', required=True)
Avatar
Discard