Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Managament
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Producție
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware and Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

What does odoo store in the one2many field ?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
storeone2manydbodoo
4 Răspunsuri
2312 Vizualizări
Imagine profil
yahya sbini


Hi ,please I want know what is going on here !

in the sons field which is on father model (one to many) ,on sons are listed in the father record ,what does father record actually store (Sons IDs ?) ...if yes how does it stored ,is this field actually in DB dynamic array where I can ad as much sons as I want ?





0
Imagine profil
Abandonează
yahya sbini
Autor

Could any one help !

Imagine profil
D Enterprise
Cel mai bun răspuns

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

ID name
1 Muhammad Sbini

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.

0
Imagine profil
Abandonează
Imagine profil
Ruchita
Cel mai bun răspuns

In Odoo, a One2many field stores a list of related records (not just IDs). Specifically, it links records from another model that have a Many2one reference back to the current model.

Internally, Odoo doesn't store data directly in the One2many field in the database. Instead, it is computed based on the Many2one field in the related model. So technically, the One2many field is not stored in the current model's table — it just provides a reverse relation for easy access to child records.

Example:

If a Sale Order has a One2many field order_line (pointing to sale.order.line), then the actual data is stored in sale.order.line using a Many2one field like order_id that points back to the sale.order.

0
Imagine profil
Abandonează
Imagine profil
Cybrosys Techno Solutions Pvt.Ltd
Cel mai bun răspuns

Hi,

You have a Father model with a field that lists sons, that's a One2many field in Odoo.

Example:

class Father(models.Model):
_name = 'my.father'

name = fields.Char(string='Father Name')
son_ids = fields.One2many('my.son', 'father_id', string="One of my sons")

class Son(models.Model):
_name = 'my.son'

name = fields.Char(string='Son Name')
father_id = fields.Many2one('my.father', string="Father")

The One2many field does NOT directly store data in the father model's database table. Instead, it works indirectly via the reverse Many2one field in the Son model. The father_id in the my.son table (DB) stores the link (foreign key).

One2many field (like the "sons" field on the father model) is a virtual relational field; it doesn't directly store any data in the father record's database table. Instead, the actual relationship is maintained through a Many2one field on the child model (in this case, each "son" record has a father_id field pointing to its parent "father"). So, when you see a list of sons under a father, Odoo is dynamically fetching all son records from the my.son table where father_id equals that father's ID. It’s not a stored list or array in the father's table; rather, it’s a reverse lookup based on the foreign key in the child model. This makes it scalable: you can add as many sons as you want, and Odoo will always pull them dynamically using a query, not by storing their IDs in the father record.


Hope it helps.

0
Imagine profil
Abandonează
Imagine profil
Accurate | www.accurates.com.sa
Cel mai bun răspuns

Hi,

In Odoo, a one2many field (like 'sons' in your father model) doesn't actually store any data directly in the father record or table. Instead, the relationship is managed through the corresponding many2one field in the child model.

Here's what's happening:

  1. The father model has a one2many field pointing to sons: sons = fields.One2many('son.model', 'father_id', string="Sons")
  2. The son model has a many2one field pointing back to father: father_id = fields.Many2one('father.model', string="Father")
  3. In the database:
    • The father table doesn't have a column for sons
    • Each son record in the son table has a column called father_id that stores the ID of its parent

When you view a father record and see the list of sons, Odoo dynamically fetches all son records where father_id equals the current father's ID. This is done through a database query, not by accessing a stored array.

So to answer your questions directly:

  • No, the father record doesn't store sons' IDs
  • There is no array field in the database table
  • You can add as many sons as you want because each new son simply gets a new record in the son table with the appropriate father_id value

This design is a standard relational database pattern that allows for efficient storage and querying of one-to-many relationships without size limitations.

Regards,

Jishna

Accurates



0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
how delete a Line in one2Many field ?
one2many odoo
Imagine profil
Imagine profil
Imagine profil
Imagine profil
3
iul. 25
22961
Insert values to one2many field on specific record of the partner
one2many odoo
Imagine profil
0
sept. 23
144
Enable to select an entity on one2many list Rezolvat
one2many odoo
Imagine profil
Imagine profil
Imagine profil
2
ian. 24
16989
Domain on one2many field
one2many odoo
Imagine profil
Imagine profil
1
apr. 17
6592
Get active id value of One2many record which Clicked
one2many context odoo
Imagine profil
Imagine profil
1
iul. 25
2517
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now