Zum Inhalt springen
Odoo Menü
  • Anmelden
  • Jetzt gratis testen
  • Apps
    Finanzen
    • Buchhaltung
    • Rechnungsstellung
    • Spesenabrechnung
    • Tabellenkalkulation (BI)
    • Dokumente
    • E-Signatur
    Vertrieb
    • CRM
    • Vertrieb
    • Kassensystem – Shop
    • Kassensystem – Restaurant
    • Abonnements
    • Vermietung
    Websites
    • Website-Builder
    • E-Commerce
    • Blog
    • Forum
    • Livechat
    • E-Learning
    Lieferkette
    • Lager
    • Fertigung
    • PLM
    • Einkauf
    • Wartung
    • Qualität
    Personalwesen
    • Mitarbeiter
    • Personalbeschaffung
    • Abwesenheiten
    • Mitarbeiterbeurteilung
    • Personalempfehlungen
    • Fuhrpark
    Marketing-
    • Social Marketing
    • E-Mail-Marketing
    • SMS-Marketing
    • Veranstaltungen
    • Marketing-Automatisierung
    • Umfragen
    Dienstleistungen
    • Projekte
    • Zeiterfassung
    • Außendienst
    • Kundendienst
    • Planung
    • Termine
    Produktivität
    • Dialog
    • Genehmigungen
    • IoT
    • VoIP
    • Wissensdatenbank
    • WhatsApp
    Apps von Drittanbietern Odoo Studio Odoo Cloud-Plattform
  • Branchen
    Einzelhandel
    • Buchladen
    • Kleidergeschäft
    • Möbelhaus
    • Lebensmittelgeschäft
    • Baumarkt
    • Spielwarengeschäft
    Essen & Gastgewerbe
    • Bar und Kneipe
    • Restaurant
    • Fast Food
    • Gästehaus
    • Getränkehändler
    • Hotel
    Immobilien
    • Immobilienagentur
    • Architekturbüro
    • Baugewerbe
    • Immobilienverwaltung
    • Gartenarbeit
    • Eigentümervereinigung
    Beratung
    • Buchhaltungsfirma
    • Odoo-Partner
    • Marketingagentur
    • Anwaltskanzlei
    • Talentakquise
    • Prüfung & Zertifizierung
    Fertigung
    • Textil
    • Metall
    • Möbel
    • Speisen
    • Brauerei
    • Firmengeschenke
    Gesundheit & Fitness
    • Sportklub
    • Brillengeschäft
    • Fitnessstudio
    • Therapeut
    • Apotheke
    • Friseursalon
    Handel
    • Handyman
    • IT-Hardware & -Support
    • Solarenergiesysteme
    • Schuster
    • Reinigungsdienstleistungen
    • HLK-Dienstleistungen
    Sonstiges
    • Gemeinnützige Organisation
    • Umweltschutzagentur
    • Plakatwandvermietung
    • Fotostudio
    • Fahrrad-Leasing
    • Software-Händler
    Alle Branchen ansehen
  • Community
    Lernen
    • Tutorials
    • Dokumentation
    • Zertifizierungen
    • Schulung
    • Blog
    • Podcast
    Bildung fördern
    • Bildungsprogramm
    • Scale-Up! Planspiel
    • Odoo besuchen
    Software anfragen
    • Herunterladen
    • Editionen vergleichen
    • Releases
    Zusammenarbeiten
    • Github
    • Forum
    • Veranstaltungen
    • Übersetzungen
    • Partner werden
    • Dienstleistungen für Partner
    • Buchhaltungsfirma registrieren
    Services anfragen
    • Partner finden
    • Buchhalter finden
    • Einen Experten treffen
    • Implementierungsservices
    • Kundenreferenzen
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Eine Demo erhalten
  • Preiskalkulation
  • Hilfe

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

  • CRM
  • e-Commerce
  • Buchhaltung
  • Lager
  • PoS
  • Projekte
  • MRP
All apps
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Sie müssen registriert sein, um mit der Community zu interagieren.
Alle Beiträge Personen Abzeichen
Stichwörter (Alle anzeigen)
odoo accounting v14 pos v15
Über dieses Forum
Hilfe

Double Field Access? Python ORM API Odoo 11. Three dots. Confusion.

Abonnieren

Erhalten Sie eine Benachrichtigung, wenn es eine Aktivität zu diesem Beitrag gibt

Diese Frage wurde gekennzeichnet
OdooPythonORMOdoo11.0
1 Antworten
3593 Ansichten
Avatar
Kyle

Double Field Access??!?


I had a question about the ORM API. I am using the Python interface to Odoo. I am looking at this documentation:\https://www.odoo.com/documentation/11.0/reference/orm.html#field-access


The documentation shows how to access a field like so: table_name.column_name. However, there is another example like this: table_name.column_name.other_column_name. What does this mean? Please let me know if this does not make sense. 

Example

>>> record.name
Example Name

>>> record.company_id.name
Company Name

>>> record.name = "Bob"

>>> field = "name"

>>> record[field]
Bob
The above code shows there is a table called "record".  We do not know what columns are in this table however, which adds some confusion. We can see that we can access a column in the "record" table by doing this "record[field]" or like this "record.field".  What I am confused about is what this code is doing  -> \record.company_id.name. This seems  like  the code is referencing a column from another column. Something like if "record" is a table name. Then "company_id" is a column name. Then again "name" is also a column name. How does this make sense? What is returned? Why is the example database not shown? Is the example database shown somewhere else that I am missing? 


Thank-you for reading this!

0
Avatar
Verwerfen
Avatar
Ray Carnes (ray)
Beste Antwort

This is a way of navigating relationships between tables**

Sometimes the  information  in  the field is  simple,  like  'name'.

Sometimes  the  information  in  the  field  is  relational,  like  'company_id'  and  'country_id'  in  which  case  you  can  navigate  through  the  relationship  to  the  next  table  and  get  information  from  that  one,  at any number of levels.




record.name = "Anne" for record with id =  1 when the record is a User

record.name = "ACME" for record with id = 1 when the record is a Company

record.name = "United States" for record with id = 233  when the record is a Country

record.company_id.name = "ACME" for records with id = 1, 2 and 3 when the record is a User

record.company_id.country_id.name = "United States" for records with id = 1, 2 and 3 when the record is a User

record.company_id.country_id = 233 for records with id = 1, 2 and 3 when the record is a User

record.name = "United  States" for record with id = 233 when the record is a Country


** called models in Odoo because they contain:

  •  fields of simple information stored in the PostgreSQL table
  •  fields representing relationships stored in the PostgreSQL table
  •  fields of information calculated via Python that are not stored in PostgreSQL
  •  business logic defined in Python that is not stored in PostgreSQL.


2
Avatar
Verwerfen
Kyle
Autor

So a triple-field is accessing multiple tables? How can I tell which tables are linked together? Or in other words, how can I tell which tables are related? Thank-you for the excellent answer. I think I understand. I at least have a much better understanding now than previously. :)

Ray Carnes (ray)

In Developer Model, use the FIELDS Menu. Filter for the model you are interested in, select just MANY2ONE fields and look at the Related Model column. If the column is blank for a given field, then that field contains simple information. If not, the model it is related to will be show in that column.

Kyle
Autor

Excellent. This is very helpful information Ray. 👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍👍 I appreciate you taking the time to help me understand this! 💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻💻

Diskutieren Sie gerne? Treten Sie bei, statt nur zu lesen!

Erstellen Sie heute ein Konto, um exklusive Funktionen zu nutzen und mit unserer tollen Community zu interagieren!

Registrieren
Verknüpfte Beiträge Antworten Ansichten Aktivität
Odoo python backend question
ORM
Avatar
0
Aug. 24
2042
When is write() triggered when updating properties of an object Gelöst
ORM
Avatar
Avatar
1
Juli 24
3010
How do you add direct attributable cost to an asset...
Odoo
Avatar
0
Okt. 22
796
Concurrent updates of a record
ORM
Avatar
Avatar
1
März 22
6029
how to add new magic columns?
ORM
Avatar
Avatar
1
Juni 21
4039
Community
  • Tutorials
  • Dokumentation
  • Forum
Open Source
  • Herunterladen
  • Github
  • Runbot
  • Übersetzungen
Dienstleistungen
  • Odoo.sh-Hosting
  • Support
  • Upgrade
  • Individuelle Entwicklungen
  • Bildung
  • Buchhalter finden
  • Partner finden
  • Partner werden
Über uns
  • Unsere Firma
  • Markenwerte
  • Kontakt
  • Karriere
  • Veranstaltungen
  • Podcast
  • Blog
  • Kunden
  • Rechtliches • Datenschutz
  • Sicherheit
الْعَرَبيّة 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 ist eine Suite von Open-Source-Betriebsanwendungen, die alle Bedürfnisse Ihres Unternehmens abdecken: CRM, E-Commerce, Buchhaltung, Lager, Kassensystem, Projektmanagement etc.

Das einzigartige Wertversprechen von Odoo ist, dass es gleichzeitig sehr einfach zu bedienen und voll integriert ist.

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