I have 3 classes:
class Parent(models.Model):
_name='parent.parent'
class Child1(models.Model):
_name="child.child1"
_inherits={'parents.parents': 'parent_id'}
parent_id = fields.Many2one('parent.parent', required=True, ondelete="cascade")
class Child2(models.Model):
_name="child.child2"
_inherits={'parents.parents': 'parent_id'}
parent_id = fields.Many2one('parent.parent', required=True, ondelete="cascade")
How can I navigate from parent.parent to his (all) children? Do I need to declare to new fields in the parent like ?:
child1 = fields.Many2one('child.child1', store=False)
child2 = fields.Many2one('child.child2', store=False)
Is there a better solution?
'store' is used for computed fields which are by default not stored in database, so you can add store=True to store it.
In your example, the use of store=False is irrelevant.
Also, it seems you need to understand better the inheritance concept and relational field concept. See my answer below.