Hii,
No , the Father record does not directly store Son IDs in the database.
The relationship is stored on the Son model , where each Son has a foreign key (father_id) pointing back to the Father.
So:
-
Odoo's One2many field in the Father model just reads data from the Many2one field in the Son model.
-
This is not a dynamic array or list stored inside the Father row — it's a relational link across tables.
Technical Structure Behind It:
Father Model:
class Father(models.Model):
_name = 'your.father.model'
name = fields.Char()
sons_ids = fields.One2many('your.son.model', 'father_id', string="Sons")
Latest Model:
class Son(models.Model):
_name = 'your.son.model'
name = fields.Char()
father_id = fields.Many2one('your.father.model', string="Father")
What It Looks Like in the Database:
Table: your_father_model
Table: your_son_model:
ID |
name |
father_id |
1 |
John |
1 |
2 |
Nour |
1 |
As you can see:
-
The father_id is stored in each Last record.
-
Odoo uses this to dynamically build the list (sons_ids) in the UI and ORM.
Is it a dynamic array?
No , it's not a real array or list in the DB.
It behaves like a list in the UI (like what you saw in your screenshot), but technically, it's just:
-
A set of son records
-
Each with a father_id equal to the current Father record
I hope it is of full use.
Could any one help !