Skip to Content
  • +43 (0) 1 774 03 92 - 450   hello@suppliot.eu  Jetzt kostenlose Demo sichern!
  • Follow us
    ​ ​ ​
SUPPLiot
  • Services
    Menü Icon Odoo

    Odoo

    We 💙 Odoo. Why we and 12 million users worldwide rely on Odoo, you can find out here.
    Menü Icon Implementierung

    Implementation

    We fully support you with the ERP implementation with Odoo. Learn more about our project process here.
    Menü Icon Consulting

    Consulting

    ​As an official partner, we are happy to share our expertise and experience as part of our consulting solutions.
    Menü Icon Individualentwicklung

    Custom

    With our German-speaking in-house development team, we also realise individual requirements.
  • Solutions
    Menü Icon Apps & Lösungen

    Apps

    Odo's numerous modules provide the perfect basis. Our apps solve additional requirements or guidelines of the Austrian market.

    Menü Icon Odoo 4 medical

    Odoo 4 medical

    We have expanded the open source ERP solution Odoo to include industry-relevant functions for medical supply stores, bandagists & Co.

    Menü Icon Odoo 4 logistics

    Odoo 4 logistics

    Our roots are in the transport industry. We combine all our experience from logistics and Odoo in one industry solution.

  • Odoo Insights
  • About us
    Menü Icon SUPPLiot Über uns

    About us

    Founded as a spin-off in 2019, we are fully immersed in the Odoo world. Learn more about us here.

    Menü Icon Team

    Team

    Our team consists of process understanders and digitalisers with broad economic and technical know-how.

    Menü Icon Referenzen

    References

    We can tell you a lot, but we'd rather convince you with an overview of some of our project successes.

    Menü Icon Karriere

    Career

    Become part of our team and actively contribute to the digitalisation of Austrian SMEs in varied projects.

  • Book demo
  • Jobs
    Kontakt
  • Sign in
SUPPLiot
      • Services
      • Solutions
      • Odoo Insights
      • About us
      • Book demo
      • Jobs
    • +43 (0) 1 774 03 92 - 450   hello@suppliot.eu  Jetzt kostenlose Demo sichern!
    • Follow us
      ​ ​ ​
    • Sign in
    • Kontakt

    Simplifying Nested Data Retrieval in Odoo with a Recursive Field Path Evaluator

  • Our blog
  • Simplifying Nested Data Retrieval in Odoo with a Recursive Field Path Evaluator
  • March 6, 2024 by
    Simplifying Nested Data Retrieval in Odoo with a Recursive Field Path Evaluator
    SUPPLiot GmbH, Robert Förster

    At SUPPLiot, we believe in sharing knowledge and empowering the Odoo developer community. In this blog post, we introduce a handy Python function designed to simplify the retrieval of nested data within the Odoo framework.


    The Challenge of Nested Data Retrieval

    When dealing with complex data structures in Odoo, developers often face the challenge of efficiently extracting information from nested fields. The provided Python function addresses this issue by offering a recursive approach to navigate through nested structures and retrieve the desired data.


    Understanding the Code

    Let's take a closer look at the code snippet:

    def _evaluate_field_path(self, data, field_path):
        result = []
        item_list = field_path.split('.')
        if len(item_list) == 1:  # We are at the last element of the field_path
            return data[item_list[0]]
        else:  # We are not at the last element
            current_evaluation = item_list.pop(0)
            new_data = data[current_evaluation]
            for item in new_data:
                result.append(self._evaluate_field_path(item, '.'.join(item_list)))
        return ';'.join(result)
    

    Key Features:

    1. Recursion: The function employs recursion to navigate through nested structures, making it suitable for various levels of complexity.
    2. Flexibility: Developers can easily adapt this function to their specific use cases by providing the target data and field path.
    3. String Concatenation: The results are concatenated using a semicolon, providing a clear and customizable output.

    How to Use:

    To utilize this function, simply pass your data and the desired field path. The function will traverse the nested structures and return the extracted information.

    # Example Usage
    data = {...}  # Your nested data structure
    field_path = "category.subcategory.field_name"
    result = self._evaluate_field_path(data, field_path)
    
    

    Happy Coding!

    # Odoo Technical
    How-to: A detailled look into recurring tasks in Odoo v16
    The technics behind the powerful Odoo-function

    ABOUT US

    You dream it, we code it. You can always dream, but we at SUPPLiot [səˈplaɪōti] go one step further. As a trusted partner, we understand, optimize and digitalize the business processes of our clients in the SME sector.offizieller Odoo Ready Partnerin Österreich. 

    We are a part of  Logo der FÖRSTER Group

    UNSERE LÖSUNGEN

    Odoo – the modular ERP system
    Custom Development
    SUPPLiot modules for Odoo

    

     QUIC​KLI​N​KS

    Career at SUPPLiot
    Blog
    our Odoo modules

    CONTACT US

     +43 (1) 774 03 92 - 450 

      hello@suppliot.eu


    FOLLOW US

    ​  ​  ​


    •  Home 
    • •
    • Imprint
    • •
    • Privacy Policy
    • •
    • AGB 
    Copyright © SUPPLiot GmbH
    English (US) Deutsch
    Powered by Odoo - Create a free website


    Hier gibt es Cookies.

    Möchten Sie die Verwendung von Cookies für diese Website in diesem Browser zulassen?

    Wir verwenden Cookies, um Ihr Erlebnis auf dieser Website zu verbessern. Mehr dazu erfahren Sie hier.

    alle Cookies erlauben
    nur notwendige Cookies erlauben