<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by WanditoHS on Medium]]></title>
        <description><![CDATA[Stories by WanditoHS on Medium]]></description>
        <link>https://medium.com/@dethocean?source=rss-67a7fe248d11------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MYwOgXwGUEay4J48</url>
            <title>Stories by WanditoHS on Medium</title>
            <link>https://medium.com/@dethocean?source=rss-67a7fe248d11------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:54:11 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dethocean/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Organizing Data Files and User Interfaces in Odoo]]></title>
            <link>https://medium.com/@dethocean/organizing-data-files-and-user-interfaces-in-odoo-25a3c7e2588b?source=rss-67a7fe248d11------2</link>
            <guid isPermaLink="false">https://medium.com/p/25a3c7e2588b</guid>
            <category><![CDATA[odoo-16]]></category>
            <category><![CDATA[odoo-implementation]]></category>
            <category><![CDATA[odoo-erp]]></category>
            <category><![CDATA[odoo]]></category>
            <category><![CDATA[odoo-development]]></category>
            <dc:creator><![CDATA[WanditoHS]]></dc:creator>
            <pubDate>Thu, 05 Dec 2024 08:30:14 GMT</pubDate>
            <atom:updated>2024-12-09T00:37:47.348Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to this comprehensive Odoo tutorial for beginners! If you’re new to Odoo development and want to understand how to structure user interfaces and data files, you’re in the right place. Building on our <a href="https://medium.com/@dethocean/building-a-library-application-in-odoo-a-step-by-step-guide-for-beginners-cc2f3aa6b602">previous post</a> about creating a simple <strong>Library Application</strong>, this tutorial will guide you through the essential components like window actions, menus, and views, while explaining how they interact. By the end of this post, you’ll have a clearer understanding of organizing your module for effective Odoo development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ydnWyPhVVYjk7Pj2k7gHrA.png" /><figcaption>Odoo Tutorial For Beginners: Data Files and User Interfaces</figcaption></figure><h3><strong>Where to Place Data Files?</strong></h3><p>Data files in Odoo modules can be placed anywhere, but the convention is to store user interface definitions inside a views/ subdirectory.</p><p>For our library.book model, we placed the user interface in views/library_book.xml. Naming files after their corresponding models helps maintain organization.</p><h3><strong>Window Actions, Menus, and Views</strong></h3><p>Before diving into the details, here’s a simple diagram to illustrate the relationship between <strong>Window Actions</strong>, <strong>Menus</strong>, and <strong>Views</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*zuTalfJdp17AfRdjGZDw1A.jpeg" /><figcaption>Relation Between Windows Action, Menu and View</figcaption></figure><ul><li><strong>Tree/List View </strong>and<strong> Form View</strong>: These represent how data is displayed to the user. They are connected to a <strong>Window Action</strong> via the view_mode (which specifies the type of views) and the res_model (which defines the underlying data model).</li><li><strong>Window Action</strong>: This serves as the link between views and the menu system. It determines how and what data is displayed in the main interface, based on the specified views and model.</li><li><strong>Menu Item</strong>: This is what users interact with in the Odoo navigation menu. A menu item “uses” a window action to determine what content is shown when it is clicked.</li></ul><h3><strong>Defining Window Actions</strong></h3><p>Window actions are a cornerstone of Odoo’s interface, connecting views and menus to enable user interaction with specific models. A window action not only defines which model and views are displayed but also acts as the bridge between the menu items and the views. Without a properly defined window action, the menu item would lack the necessary functionality to display the intended data.</p><p>Here’s the window action from our previous post that displays the interface:</p><pre>&lt;record id=&quot;library_book_action&quot; model=&quot;ir.actions.act_window&quot;&gt;  <br>    &lt;field name=&quot;name&quot;&gt;Library Books&lt;/field&gt;  <br>    &lt;field name=&quot;res_model&quot;&gt;library.book&lt;/field&gt;  <br>    &lt;field name=&quot;view_mode&quot;&gt;tree,form&lt;/field&gt;  <br>&lt;/record&gt;</pre><p>Let’s examine the key attributes of this action:</p><ol><li>id:</li></ol><ul><li>This unique identifier is crucial because it allows other components, like menu items, to reference this window action.</li><li>For example, when defining a menu item, its action attribute will point to the id of this window action. Without the correct id, the menu cannot trigger the window action, and users won’t be able to access the views.</li><li><strong>Best Practice</strong>: Use a descriptive and consistent naming convention for id, like library_book_action, to make it easy for developers to understand its purpose.</li></ul><p>2. model=&quot;ir.actions.act_window&quot;:</p><ul><li>Indicates that this record is creating a window action.</li><li>The ir.actions.act_window model is responsible for defining how views are displayed and how users interact with the underlying data.</li></ul><p>3. name:</p><ul><li>This is the name displayed to the user when the action is triggered.</li><li>Choose a user-friendly name, like “Library Books,” that accurately describes the data or feature.</li></ul><p>4. res_model:</p><ul><li>Specifies the model the window action is tied to.</li><li>In this case, it’s the library.book model, meaning that this action will display and interact with records from the library.book model.</li></ul><p>5. view_mode:</p><ul><li>Defines the sequence of views displayed to the user.</li><li>For example, tree,form means the list (tree) view is shown first, and the detailed (form) view appears when a record is clicked.</li><li>Odoo identifies the views to display based on the res_model and view_mode. If multiple views exist for the same type, their priority determines which is shown.</li></ul><h4>The Role of Window Actions</h4><p>When a user clicks a menu item, Odoo checks the menu’s action attribute to determine which window action to execute. The window action, in turn:</p><ul><li>Specifies the <strong>model</strong> (res_model) whose data will be displayed.</li><li>Determines the <strong>types of views</strong> (view_mode) to render.</li><li>Connects the views and filters them according to the model’s data.</li></ul><h3><strong>Defining Menu Items</strong></h3><p>Menu items are what users interact with to navigate the application. They act as entry points that trigger actions, such as opening a window to display specific data or perform a task. In our <em>Library Application</em>, we created a menu item that connects to the library_book_action window action we defined earlier.</p><p>Here’s the code snippet for the menu item:</p><pre>&lt;menuitem id=&quot;library_base_menu&quot; name=&quot;Library&quot; /&gt;  <br><br>&lt;menuitem id=&quot;library_book_menu&quot; name=&quot;Books&quot;  <br>          parent=&quot;library_base_menu&quot; action=&quot;library_book_action&quot; /&gt;</pre><p>Let’s dig deeper into the attributes:</p><ol><li>id:</li></ol><ul><li>The id is a unique identifier for each menu item. It is essential for referencing this menu item in other parts of the module, such as when defining submenus (via the parent attribute).</li><li><strong>Best Practice</strong>: Use descriptive names for id, such as library_base_menu for the root menu and library_book_menu for the &quot;Books&quot; submenu. This makes it easy to understand the hierarchy and purpose of the menu items.</li></ul><p>2. name:</p><ul><li>This is the text displayed to the user in the menu. In this example, “Library” is the root menu, and “Books” is a submenu under it.</li><li><strong>Tip</strong>: Ensure the name attribute is user-friendly and aligns with the functionality provided.</li></ul><p>3. parent:</p><ul><li>Refers to the id of the parent menu item. This creates a hierarchical structure.</li><li>In this example, library_book_menu is a child of library_base_menu.</li></ul><p>4. action:</p><ul><li>Points to the id of the window action to be executed when this menu item is clicked.</li><li>In this case, action=&quot;library_book_action&quot; links the &quot;Books&quot; menu to the library_book_action window action, ensuring that the correct views and data for library.book are displayed.</li><li><strong>Key Insight</strong>: This attribute connects menu items to window actions, making it a vital component in the navigation setup.</li></ul><h3><strong>Defining Views</strong></h3><p>Views provide the interface for displaying and editing records. Odoo supports various view types, including <strong>Form</strong>, <strong>Tree</strong>, and <strong>Search</strong> views. These are the views we previously defined for our model:</p><p><strong>Form and Tree View</strong></p><pre>    &lt;record id=&quot;library_book_view_form&quot; model=&quot;ir.ui.view&quot;&gt;  <br>        &lt;field name=&quot;name&quot;&gt;Library Book Form&lt;/field&gt;  <br>        &lt;field name=&quot;model&quot;&gt;library.book&lt;/field&gt;  <br>        &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;  <br>            &lt;form&gt;  <br>                &lt;group&gt;  <br>                    &lt;group&gt;  <br>                        &lt;field name=&quot;name&quot;/&gt;  <br>                        &lt;field name=&quot;author_ids&quot; widget=&quot;many2many_tags&quot; /&gt;  <br>                        &lt;field name=&quot;state&quot;/&gt;  <br>                        &lt;field name=&quot;pages&quot; /&gt;  <br>                        &lt;field name=&quot;notes&quot; /&gt;  <br>                    &lt;/group&gt;  <br>                    &lt;group&gt;  <br>                        &lt;field name=&quot;short_name&quot;/&gt;  <br>                        &lt;field name=&quot;date_release&quot;/&gt;  <br>                        &lt;field name=&quot;date_updated&quot;/&gt;  <br>                        &lt;field name=&quot;cover&quot; widget=&quot;image&quot; class=&quot;oe_avatar&quot; /&gt;  <br>                        &lt;field name=&quot;reader_rating&quot; /&gt;  <br>                    &lt;/group&gt;  <br>                &lt;/group&gt;    <br>                    &lt;field name=&quot;description&quot;/&gt;  <br>                &lt;group&gt;  <br>                &lt;/group&gt;    <br>            &lt;/form&gt;  <br>        &lt;/field&gt;  <br>    &lt;/record&gt;  <br><br>    &lt;record id=&quot;library_book_view_tree&quot; model=&quot;ir.ui.view&quot;&gt;  <br>        &lt;field name=&quot;name&quot;&gt;Library Book List&lt;/field&gt;  <br>        &lt;field name=&quot;model&quot;&gt;library.book&lt;/field&gt;  <br>        &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;  <br>            &lt;tree&gt;  <br>                &lt;field name=&quot;name&quot;/&gt;  <br>                &lt;field name=&quot;date_release&quot;/&gt;  <br>            &lt;/tree&gt;  <br>        &lt;/field&gt;  <br>    &lt;/record&gt;</pre><p>In Odoo XML, <strong>tree views</strong> define how records are displayed in a list format, with each column representing a field. They use the &lt;tree&gt; tag, and fields are added using &lt;field&gt; elements. Tree views are ideal for quick overviews and batch operations. <strong>Form views</strong>, on the other hand, provide a detailed view of a single record. They are defined using the &lt;form&gt; tag and often include &lt;group&gt; elements to organize fields in a structured layout. While tree views focus on summarizing multiple records, form views focus on in-depth interaction with a single record.</p><p><strong>Note:</strong> The <strong>name</strong> attribute inside the &lt;field&gt; tag is not fixed; you can name it whatever makes sense for your application. In this case, we used descriptive names (library.book.tree and library.book.form) to help developers identify the purpose of each record quickly.</p><p><strong>Search View</strong></p><pre>    &lt;record id=&quot;library_book_view_search&quot; model=&quot;ir.ui.view&quot;&gt;  <br>        &lt;field name=&quot;name&quot;&gt;Library Book Search&lt;/field&gt;  <br>        &lt;field name=&quot;model&quot;&gt;library.book&lt;/field&gt;  <br>        &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;  <br>            &lt;search&gt;  <br>                &lt;field name=&quot;name&quot;/&gt;  <br>                &lt;field name=&quot;author_ids&quot;/&gt;  <br>                &lt;filter string=&quot;No Authors&quot; name=&quot;without_author&quot; domain=&quot;[(&#39;author_ids&#39;,&#39;=&#39;,False)]&quot; /&gt;  <br>            &lt;/search&gt;  <br>        &lt;/field&gt;  <br>    &lt;/record&gt;</pre><p>Here is an explanation of the attributes for filters in a <strong>search view</strong>:</p><ol><li>string</li></ol><ul><li>The label displayed to users for the filter option in the search view.</li><li>Example: string=&quot;No Authors&quot; creates a filter labeled &quot;No Authors&quot; in the UI.</li></ul><p>2. name</p><ul><li>A unique identifier for the filter.</li><li>Used internally by Odoo to track the state of the filter.</li><li>Example: name=&quot;without_author&quot; ensures the filter is recognized as &quot;without_author&quot; in the backend.</li></ul><p>3. domain</p><ul><li>Defines the filter logic to retrieve specific records.</li><li>Written as a list of conditions applied to the model’s fields.</li><li>Example: domain=&quot;[(&#39;author_ids&#39;, &#39;=&#39;, False)]&quot; filters records where the author_ids field is empty.</li></ul><h3><strong>How Odoo Matches Window Actions and Views</strong></h3><p>A common misconception among beginners is that the <strong>IDs</strong> or <strong>names</strong> of window actions and views need to match or follow a strict naming pattern for Odoo to recognize and link them. However, this is not the case. Odoo does not rely on these attributes to connect window actions to views. Instead, the process is governed by the <strong>view_mode</strong> and <strong>res_model</strong> attributes.</p><p>The <strong>res_model</strong> in a window action specifies the model it is intended to work with, while the <strong>view_mode</strong> determines the types of views (e.g., form, tree, kanban) to display for that model. For instance, in the example we provided earlier, the <strong>window action for Library Books</strong> has res_model=&quot;library.book&quot;. This ensures that only views tied to the library.book model are considered when rendering the interface.</p><p>Odoo uses the <strong>model</strong> attribute in views (e.g., library.book) to find the appropriate views, regardless of their IDs or names. This flexibility ensures that developers can organize their code as they see fit.</p><h3><strong>Why Naming Conventions Matter</strong></h3><p>Although Odoo does not enforce a naming relationship between window actions and views, it’s a <strong>best practice</strong> to name them systematically. For example:</p><ul><li><strong>Window Action:</strong> library_book_action</li><li><strong>Tree View:</strong> library_book_view_tree</li><li><strong>Form View:</strong> library_book_view_form</li></ul><p>This convention helps developers quickly identify which views are linked to which models and actions, avoiding unnecessary confusion when navigating or debugging the code.</p><h3>Conclusion</h3><p>In this post, we explored the key concepts and practices for organizing data files and defining user interfaces in Odoo. We learned how to structure views, window actions, and menu items to create a seamless and functional application. Additionally, we clarified common misconceptions about IDs and names, emphasizing how Odoo links window actions and views using view_mode and res_model.</p><p>By following best practices, such as naming conventions and organizing files in the module structure, you can build scalable and maintainable Odoo applications. This foundational knowledge not only streamlines development but also lays the groundwork for more advanced customizations.</p><p>In the next post, we will dive deeper into access controls and other advanced topics to further enhance the functionality and security of your Odoo modules. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=25a3c7e2588b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Library Application in Odoo: A Step-by-Step Guide for Beginners]]></title>
            <link>https://medium.com/@dethocean/building-a-library-application-in-odoo-a-step-by-step-guide-for-beginners-cc2f3aa6b602?source=rss-67a7fe248d11------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc2f3aa6b602</guid>
            <category><![CDATA[odoo-development]]></category>
            <category><![CDATA[odoo-implementation]]></category>
            <category><![CDATA[odoo-tutorials]]></category>
            <category><![CDATA[odoo-apps]]></category>
            <category><![CDATA[odoo]]></category>
            <dc:creator><![CDATA[WanditoHS]]></dc:creator>
            <pubDate>Sun, 17 Nov 2024 09:45:04 GMT</pubDate>
            <atom:updated>2024-12-09T00:51:33.819Z</atom:updated>
            <content:encoded><![CDATA[<p>In this tutorial, we will build a <strong>Library Application</strong> using Odoo. This application will be slightly more complex than the previous <a href="https://medium.com/@dethocean/building-a-super-simple-application-in-odoo-tutorial-for-beginners-c0c488d778af">To-Do Application</a> and will serve as a foundation for future extensions. By the end of this guide, you’ll have a Library Management system with basic book record.</p><figure><img alt="Odoo Tutorial for Beginners: Step-by-Step Guide to Building a Basic Library Application" src="https://cdn-images-1.medium.com/max/1024/1*VRaWq2lQBQca6UJY0-QX8Q.png" /><figcaption>Tutorial For Beginners: Basic Library Application</figcaption></figure><h3>Prerequisites</h3><p>Before you start, ensure the following:</p><ul><li><strong>Odoo Installed</strong>: Preferably with developer mode enabled</li><li><strong>Basic Knowledge</strong>: Familiarity with Python, XML, and PostgreSQL.</li><li><strong>A Code Editor</strong>: Any editor like VS Code or PyCharm will do.</li><li><strong>Previous Experience</strong>: Completion of the <a href="https://medium.com/@dethocean/building-a-super-simple-application-in-odoo-tutorial-for-beginners-c0c488d778af">To-Do Application</a> tutorial is recommended.</li></ul><h3>Step 1: Setting Up the Module Structure</h3><p>Create a new directory for your module called my_library. It’s considered as best practice to place your module on separate folder from Odoo default addons folder. See <a href="https://medium.com/@dethocean/odoo-tutorial-for-beginners-understanding-important-files-and-folders-40a57df66f7d">this</a> tutorial for guidance to add your custom addons path.</p><pre>my_library/  <br>├── __init__.py  <br>├── __manifest__.py  <br>├── models/  <br>│   ├── __init__.py  <br>│   ├── library_book.py  <br>├── views/  <br>│   ├── library_book.xml</pre><h3>Step 2: Manifest and Init File</h3><p>Define the __manifest__.py file to register the module:</p><pre>{<br>    &#39;name&#39;: &#39;My Library&#39;,<br>    &#39;summary&#39;: &#39;Manage books easily&#39;,<br>    &#39;description&#39;: &quot;Manage Library&quot;,<br>    &#39;depends&#39;: [&#39;base&#39;],<br>    &#39;category&#39;: &#39;Services/Library&#39;,<br>    &#39;version&#39;: &#39;1.0.0&#39;,  <br>    &#39;author&#39;: &quot;Your Name&quot;,<br>    &#39;website&#39;: &quot;https://example.com&quot;,<br>    &#39;data&#39;: [<br>        &#39;views/library_book.xml&#39;,<br>    ],    <br>}</pre><p>Next, create an __init__.py file to import the models directory:</p><pre>from . import models</pre><h3>Step 3: Defining Models</h3><p>Models are the backbone of an Odoo application, representing the data structure and business logic. They define how data is stored, processed, and related within the system. In this step, we’ll create a model for our Library Application to manage book information.</p><p>Create the model ‘library.book’ in models\library_book.py:</p><pre>from odoo import models, fields  <br><br>class LibraryBook(models.Model):  <br>    _name = &#39;library.book&#39;  <br>    _description = &#39;Library Book&#39;  <br><br>    name = fields.Char(string=&#39;Title&#39;, required=True)  <br>    date_release = fields.Date(string=&#39;Release Date&#39;)  <br>    author_ids = fields.Many2many(&#39;res.partner&#39;, string=&#39;Authors&#39;)</pre><p>The <strong>author_ids</strong> field uses a many2many relationship to link books with its author. We’ll delve deeper into many2one, one2many and many2many relationships and their implementations in Odoo in an upcoming post</p><p>Import this model in models\__init__.py:</p><pre>from . import library_book</pre><h3>Step 4: Creating Views</h3><p>Once the data structure models are ready, the next step is to create a user interface for users to interact with the data. In this section, we’ll build on the Library Book model by adding a menu item that displays a user interface with list and form views.</p><p>In views\book_views.xml:</p><pre>&lt;odoo&gt;<br>    &lt;record id=&quot;library_book_action&quot; model=&quot;ir.actions.act_window&quot;&gt;<br>            &lt;field name=&quot;name&quot;&gt;Library Books&lt;/field&gt;<br>            &lt;field name=&quot;res_model&quot;&gt;library.book&lt;/field&gt;<br>            &lt;field name=&quot;view_mode&quot;&gt;tree,form&lt;/field&gt;<br>    &lt;/record&gt;<br><br>    &lt;record id=&quot;library_book_view_form&quot; model=&quot;ir.ui.view&quot;&gt;  <br>        &lt;field name=&quot;name&quot;&gt;Library Book Form&lt;/field&gt;  <br>        &lt;field name=&quot;model&quot;&gt;library.book&lt;/field&gt;  <br>        &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;  <br>            &lt;form&gt;  <br>                &lt;group&gt;  <br>                    &lt;group&gt;  <br>                        &lt;field name=&quot;name&quot;/&gt;  <br>                        &lt;field name=&quot;author_ids&quot; widget=&quot;many2many_tags&quot; /&gt;  <br>                    &lt;/group&gt;  <br>                    &lt;group&gt;  <br>                        &lt;field name=&quot;date_release&quot;/&gt;  <br>                    &lt;/group&gt;  <br>                &lt;/group&gt;    <br>            &lt;/form&gt;  <br>        &lt;/field&gt;  <br>    &lt;/record&gt;  <br><br>    &lt;record id=&quot;library_book_view_tree&quot; model=&quot;ir.ui.view&quot;&gt;  <br>        &lt;field name=&quot;name&quot;&gt;Library Book List&lt;/field&gt;  <br>        &lt;field name=&quot;model&quot;&gt;library.book&lt;/field&gt;  <br>        &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;  <br>            &lt;tree&gt;  <br>                &lt;field name=&quot;name&quot;/&gt;  <br>                &lt;field name=&quot;date_release&quot;/&gt;  <br>            &lt;/tree&gt;  <br>        &lt;/field&gt;  <br>    &lt;/record&gt;  <br><br>    &lt;record id=&quot;library_book_view_search&quot; model=&quot;ir.ui.view&quot;&gt;  <br>        &lt;field name=&quot;name&quot;&gt;Library Book Search&lt;/field&gt;  <br>        &lt;field name=&quot;model&quot;&gt;library.book&lt;/field&gt;  <br>        &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;  <br>            &lt;search&gt;  <br>                &lt;field name=&quot;name&quot;/&gt;  <br>                &lt;field name=&quot;author_ids&quot;/&gt;  <br>                &lt;filter string=&quot;No Authors&quot; name=&quot;without_author&quot; domain=&quot;[(&#39;author_ids&#39;,&#39;=&#39;,False)]&quot; /&gt;  <br>            &lt;/search&gt;  <br>        &lt;/field&gt;  <br>    &lt;/record&gt;<br><br>    &lt;menuitem name=&quot;My Library&quot; <br>              id=&quot;library_base_menu&quot; /&gt;<br><br>    &lt;menuitem name=&quot;Books&quot; <br>              id=&quot;library_book_menu&quot; <br>              parent=&quot;library_base_menu&quot; <br>              action=&quot;library_book_action&quot; /&gt;<br><br>&lt;/odoo&gt;</pre><p>If you notice, I adds a search bar with filters for the <strong>name</strong> and <strong>author_ids</strong> fields, along with a specific filter to find books that don’t have any authors. In an upcoming post, we’ll dive deeper into how search views work in Odoo, explore advanced search configurations, and create dynamic filters for more complex needs.</p><h3>Step 5: Accessing Module as Super User</h3><p>When you add a new model in Odoo, it doesn’t automatically have any access rights. This means that regular users, including administrators, won’t be able to see menus, views, or interact with the new model until specific access rights are defined.</p><p>In our example, we haven’t set up any access rights yet, so the menus and views for the Library Application are not visible to users. However, there’s a shortcut to bypass this restriction: using <strong>Superuser Mode</strong>.</p><p>Superuser Mode allows you to bypass access rights entirely, giving you visibility into menus and views without needing to define permissions. This is especially helpful during the development phase of your application.</p><p>Steps to Enable Superuser Mode:</p><h4><strong>1. Activate Developer Mode</strong></h4><ul><li>Go to your <strong>Odoo Settings</strong>.</li><li>At the bottom, select <strong>Activate Developer Mode</strong>.</li></ul><h4>2. <strong>Switch to Superuser Mode</strong></h4><ul><li>After activating Developer Mode, access the developer tools menu (top-right menu with bug symbol).</li><li>Click on the <strong>Become Superuser</strong> option.</li></ul><p>As a superuser, you can now access all menus, views, and models, even without explicitly defined access rights.</p><p>Use Superuser Mode only during development or debugging to avoid security risks. Once your application is ready, ensure you define proper access rights for each model so that only authorized users can access specific features, creating a secure and well-structured environment for your application.</p><p>In this post, we’re using the superuser mode as an educational tool to demonstrate the application and functionality of the Library module. However, in the next post, we’ll cover how to define proper access controls to ensure your application is secure and follows best practices. Stay tuned!</p><h3>Step 6: Registering and Installing the Module</h3><p>To register and install your module, follow the same steps outlined in our <a href="https://medium.com/@dethocean/building-a-super-simple-application-in-odoo-tutorial-for-beginners-c0c488d778af">previous post</a>. These include restarting Odoo, updating the app list, and installing your custom module from the Apps menu.</p><p>Refer to that guide for a detailed walkthrough of the process!</p><h3>Conclusion</h3><p>Congratulations! You’ve built a basic Library Application in Odoo, covering models, views, and access controls. These are fundamentals of module that will serve as the foundation for building more advanced applications.</p><p>To further enhance your understanding, check out our <a href="https://medium.com/@dethocean/organizing-data-files-and-user-interfaces-in-odoo-25a3c7e2588b">post</a> that provides an in-depth exploration of how to structure your module effectively, including window actions, menus, and views, along with practical best practices for organizing your code.</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc2f3aa6b602" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Super Simple Application in Odoo: Tutorial for Beginners]]></title>
            <link>https://medium.com/@dethocean/building-a-super-simple-application-in-odoo-tutorial-for-beginners-c0c488d778af?source=rss-67a7fe248d11------2</link>
            <guid isPermaLink="false">https://medium.com/p/c0c488d778af</guid>
            <category><![CDATA[odoo-tutorials]]></category>
            <category><![CDATA[odoo-apps-development]]></category>
            <category><![CDATA[odoo-module]]></category>
            <category><![CDATA[odoo-development]]></category>
            <category><![CDATA[odoo]]></category>
            <dc:creator><![CDATA[WanditoHS]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 08:57:12 GMT</pubDate>
            <atom:updated>2024-12-04T23:06:30.442Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re exploring Odoo development and want a practical, hands-on project, this Odoo tutorial for beginners will guide you in building a basic ‘<em>To Do Apps’</em> application.</p><figure><img alt="Odoo Tutorial for Beginners: Step-by-Step Guide to Building a To-Do Application" src="https://cdn-images-1.medium.com/max/1024/1*5qUyiL0ZTsOxGNBe0ylWvQ.jpeg" /><figcaption>Odoo Tutorial For Beginners: Super Simple Application</figcaption></figure><p>Odoo is a versatile platform for managing various business tasks and provides developers with robust tools for creating custom applications. This tutorial is the perfect place to start.</p><h3>Prerequisites</h3><p>Before you dive into coding, make sure you have:</p><ul><li><strong>Odoo Installed</strong>: Ideally with developer mode enabled</li><li><strong>Python and XML Knowledge</strong>: You’ll use Python for server-side logic and XML for the user interface</li><li><strong>Basic Understanding of PostgreSQL</strong>: Odoo uses PostgreSQL as its database, so some familiarity will be helpful</li></ul><h3>Step 1: Understanding Odoo’s Modular Structure</h3><p>Odoo is organized into modules, which means every feature is self-contained. Here’s a brief overview of the main components you’ll work with:</p><ul><li>models: Handle data fields and business logics</li><li>views: Define how the user interacts with the data</li><li>security: Define an access control files for setting permissions</li></ul><p>This modular approach is key to how Odoo applications are structured, making it easy to build or modify features as needed.</p><h3>Step 2: Creating The Module’s Structure</h3><p>We’ll set up a basic ‘To Do’ module where users can add tasks with a name, description, and status.</p><p>Inside your Odoo addons folder, create a new directory for your module called `todo_app`:</p><pre>todo_app/<br>├── __init__.py<br>├── __manifest__.py<br>├── models/<br>│   ├── __init__.py<br>│   └── todo_task.py<br>├── views/<br>│   └── todo_task_views.xml<br>└── security/<br>    └── ir.model.access.csv</pre><h3>Step 3: Creating the Manifest File</h3><p>The __manifest__.py file registers your module with Odoo. Here’s a simple example of the file:</p><pre>{<br>    &#39;name&#39;: &#39;To Do Apps&#39;,<br>    &#39;category&#39;: &#39;Services/Todo&#39;,<br>    &#39;version&#39;: &#39;1.0.1&#39;,<br>    &#39;author&#39;: &#39;Your Name&#39;,<br>    &#39;data&#39;: [<br>        &#39;security/ir.model.access.csv&#39;,<br>        &#39;views/todo_task_views.xml&#39;,<br>    ],<br>    &#39;application&#39;: True,<br>}</pre><p>This manifest file includes essential metadata and data files.</p><p>Next, create an __init__.py file to import the models directory:</p><pre>from . import models</pre><h3>Step 4: Defining the Task Model</h3><p>Next, create the model todo.task in models\todo_task.py:</p><pre>from odoo import models, fields<br><br>class TodoTask(models.Model):<br>    _name = &#39;todo.task&#39;<br>    _description = &#39;To Do Task&#39;<br><br>    name = fields.Char(string=&#39;Task Name&#39;, required=True)<br>    description = fields.Text(string=&#39;Description&#39;)<br>    is_done = fields.Boolean(string=&#39;Done&#39;)</pre><p>This code defines the todo.task model with fields for the task name, description, and completion status. Make sure to import this model in models\__init__.py:</p><pre>from . import todo_task</pre><h3>Step 5: Setting Access Control Rules</h3><p>To make your model accessible, define permissions in security\ir.model.access.csv:</p><pre>id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink<br>access_todo_task_user,todo.task user,model_todo_task,base.group_user,1,1,1,1</pre><p>This CSV file gives basic users the ability to read, create, edit, and delete tasks.</p><h3>Step 6: Creating Views for the ‘To Do’ Tasks</h3><p>Now, let’s create views to display and edit tasks in Odoo’s UI. In views\todo_task_views.xml, define a form and list view for todo.task:</p><pre>&lt;odoo&gt;<br>    &lt;record id=&quot;view_todo_task_form&quot; model=&quot;ir.ui.view&quot;&gt;<br>        &lt;field name=&quot;name&quot;&gt;todo.task.form&lt;/field&gt;<br>        &lt;field name=&quot;model&quot;&gt;todo.task&lt;/field&gt;<br>        &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br>            &lt;form string=&quot;To Do Task&quot;&gt;<br>                &lt;sheet&gt;<br>                    &lt;group&gt;<br>                        &lt;field name=&quot;name&quot;/&gt;<br>                        &lt;field name=&quot;description&quot;/&gt;<br>                        &lt;field name=&quot;is_done&quot;/&gt;<br>                    &lt;/group&gt;<br>                &lt;/sheet&gt;<br>            &lt;/form&gt;<br>        &lt;/field&gt;<br>    &lt;/record&gt;<br><br>    &lt;record id=&quot;view_todo_task_tree&quot; model=&quot;ir.ui.view&quot;&gt;<br>        &lt;field name=&quot;name&quot;&gt;todo.task.tree&lt;/field&gt;<br>        &lt;field name=&quot;model&quot;&gt;todo.task&lt;/field&gt;<br>        &lt;field name=&quot;arch&quot; type=&quot;xml&quot;&gt;<br>            &lt;tree string=&quot;To Do Task&quot;&gt;<br>                &lt;field name=&quot;name&quot;/&gt;<br>                &lt;field name=&quot;is_done&quot;/&gt;<br>            &lt;/tree&gt;<br>        &lt;/field&gt;<br>    &lt;/record&gt;<br><br>    &lt;record id=&quot;action_todo_task&quot; model=&quot;ir.actions.act_window&quot;&gt;<br>        &lt;field name=&quot;name&quot;&gt;To Do Tasks&lt;/field&gt;<br>        &lt;field name=&quot;res_model&quot;&gt;todo.task&lt;/field&gt;<br>        &lt;field name=&quot;view_mode&quot;&gt;tree,form&lt;/field&gt;<br>    &lt;/record&gt;<br><br>    &lt;menuitem id=&quot;menu_todo_root&quot; <br>        name=&quot;To Do&quot; /&gt;<br><br>    &lt;menuitem id=&quot;menu_todo_task_root&quot; <br>        name=&quot;To Do Task&quot; <br>        action=&quot;action_todo_task&quot; <br>        parent=&quot;menu_todo_root&quot; /&gt;<br>&lt;/odoo&gt;</pre><p>This XML sets up:</p><ul><li>A form view for adding or editing tasks</li><li>A tree view for listing tasks</li><li>A menu and action to navigate to the ‘To Do’ tasks from the Odoo interface</li></ul><h3>Step 7: Registering and Installing the Module</h3><h4>Copy the Module to Your Custom Module Folder</h4><p>To follow best practices, place your custom module, todo_app, in a separate directory, such as: C:\Program Files\Odoo 16\server\my_modules</p><p>This helps keep custom modules organized and separate from default Odoo modules. For guidance on setting up a custom module path, refer to our <a href="https://medium.com/@dethocean/odoo-tutorial-for-beginners-understanding-important-files-and-folders-40a57df66f7d">Understanding Odoo Important Files and Folders</a> post.</p><h4>Restart Odoo</h4><p>If you’re using Windows, restart Odoo from the command prompt by running:</p><pre>python odoo-bin</pre><p>If you installed Odoo as a service, restart it from “Services” (`Win + R`, type services.msc, and press Enter). Find the Odoo service and select restart.</p><h4>Updating the App List</h4><ol><li>Go to <strong>Apps</strong> in Odoo</li><li>Click <strong>Update App List</strong></li><li>Search for ‘To Do Apps’ and click activate</li></ol><p>Your ‘To Do’ application is now ready and accessible!</p><h3>Summary</h3><p>Congratulations! You’ve built a simple ‘To Do’ application in Odoo. This guide is perfect for beginners looking to get started with Odoo development. As you become more familiar with Odoo’s framework, you can enhance your app with features like automated reminders or priority levels.</p><p>Stay tuned for more Odoo tutorials for beginners on creating custom workflows, advanced data models, and integrating with existing Odoo apps!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0c488d778af" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Odoo Tutorial for Beginners: Understanding Important Files and Folders]]></title>
            <link>https://medium.com/@dethocean/odoo-tutorial-for-beginners-understanding-important-files-and-folders-40a57df66f7d?source=rss-67a7fe248d11------2</link>
            <guid isPermaLink="false">https://medium.com/p/40a57df66f7d</guid>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[odoo-development]]></category>
            <category><![CDATA[odoo-erp]]></category>
            <category><![CDATA[pgadmin-4]]></category>
            <category><![CDATA[odoo]]></category>
            <dc:creator><![CDATA[WanditoHS]]></dc:creator>
            <pubDate>Sun, 10 Nov 2024 06:54:23 GMT</pubDate>
            <atom:updated>2024-12-09T00:39:08.422Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re just starting with Odoo development, this Odoo tutorial for beginners<strong> </strong>will guide you through the essential files and folders that make up an Odoo installation. Knowing where to find critical files like odoo.conf or the addons folder can save time and improve your Odoo development experience.</p><figure><img alt="Odoo Tutorial for Beginners: Guide to Essential Files and Folders" src="https://cdn-images-1.medium.com/max/1024/1*9DyBl0YbQnedQtb06Nn1OA.jpeg" /><figcaption>Odoo Tutorial For Beginners: Important Files and Folders</figcaption></figure><h3>Overview of Odoo’s Directory Structure</h3><p>When you install Odoo, you’ll notice a directory containing various subfolders and files. These elements organize Odoo’s code, modules, and configuration settings. Let’s break down the key components and where to locate them in Windows.</p><h3>1. The `odoo` Folder</h3><p>The <em>odoo</em> folder contains all Odoo modules, both built-in and custom, that provide the platform’s various features. This folder is crucial for developing and managing Odoo applications.</p><p>Subfolders to Know:</p><ul><li><em>addons</em> : Another directory for core modules.</li><li><em>tools</em> : Helper functions and utilities.</li><li><em>service</em> : Code for managing Odoo services like starting and stopping the server.</li></ul><blockquote><em>Default Location in Windows</em>: <em>C:\Program Files\Odoo 16\server\odoo</em></blockquote><blockquote><strong>Note</strong>: Avoid editing files in the `odoo` folder directly unless you know exactly what you’re doing.</blockquote><h3>2. The `addons` Folder</h3><p>The <em>addons</em> folder is where all Odoo modules (both built-in and custom) are stored. This is the directory you’ll work with most frequently as a developer. It includes:</p><ul><li><strong>Built-in Modules</strong>: Core functionalities like Sales, CRM, and Inventory.</li><li><strong>Custom Modules</strong>: Your own applications that extend Odoo’s features.</li></ul><blockquote><em>Default Location in Windows: </em><em>C:\Program Files\Odoo 16\server\odoo\addons</em></blockquote><blockquote><strong>Tip</strong>: While you can store custom modules here, it’s considered best practice to place them elsewhere inside the Odoo folder (see the Configuration File section below).</blockquote><h3>3. Configuration File: `odoo.conf`</h3><p>The <em>odoo.conf</em> file contains the configuration settings for your Odoo instance. It defines parameters such as:</p><ul><li><strong>Database connection</strong>: Host, port, and database name.</li><li><strong>Addons path</strong>: The directories where Odoo should look for modules.</li><li><strong>Log settings</strong>: File path and log levels for debugging</li></ul><p>Here’s an example:</p><pre>[options]<br>addons_path = /path/to/odoo/addons<br>db_host = localhost<br>db_port = 5432<br>logfile = /var/log/odoo/odoo.log<br>...</pre><blockquote><em>Default Location in Windows:</em> <em>C:\Program Files\Odoo 16\server\odoo.conf</em></blockquote><blockquote><strong>Tip</strong>: Modify this file to customize how Odoo runs on your server. To add a custom add-ons folder, specify it in<em> </em><em>odoo.conf </em>with the<em> </em><em>addons_path </em>parameter. For example<em>:</em><br>addons_path = C:\Program Files\Odoo 16\server\odoo\addons, C:\Program Files\Odoo 16\server\my_modules<br>This tells Odoo to search for modules in both the default and custom folders<em>.</em></blockquote><h3>4. The `web` Folder</h3><p>The <em>web</em> folder manages web-related assets, including JavaScript, SCSS, and static files required for Odoo’s web interface.</p><p>Key Subfolders:</p><ul><li><em>controllers</em> : Handles HTTP requests and responses.</li><li><em>static</em> : Stores static files like images, JS scripts, and SCSS styles.</li><li><em>views</em> : Manages templates and UI components.</li></ul><blockquote><em>Default Location in Windows:</em> <em>C:\Program Files\Odoo 16\server\odoo\addons\web</em></blockquote><blockquote>Customizing assets in the `web` folder can help you create a tailored user experience.</blockquote><h3>5. The `odoo.log` File</h3><p>The <em>odoo.log</em> records server activity and errors, helping developers troubleshoot issues quickly.</p><p>Why <em>odoo.log</em>is important:</p><ul><li><strong>Debugging</strong>: When something goes wrong, the log file provides detailed information to help you troubleshoot the issue.</li><li><strong>Monitoring</strong>: Keep an eye on system activities and performance to ensure everything runs smoothly.</li><li><strong>Audit Trail</strong>: Review who accessed what, and track any suspicious behavior.</li></ul><p>You can open the <em>odoo.log</em> file in any text editor. For real-time monitoring, use a terminal with a tail command if you’re on Windows Subsystem for Linux (WSL) or use a log viewing tool on Windows.</p><blockquote><em>Default Location in Windows:</em> The log file’s location is defined in the `odoo.conf` configuration file. By default, it is often set to <em>C:\Program Files\Odoo 16\server\odoo.log</em>.</blockquote><h3>6. Using `pgAdmin` to Access the Database</h3><p>Odoo uses PostgreSQL as its database management system. pgadmin is a graphical user interface (GUI) tool that makes it easier to manage and interact with your PostgreSQL databases.</p><blockquote><em>Default Location in Windows: </em><em>C:\Program Files\Odoo 16\PostgreSQL\pgadmin 4\bin\pgadmin4.exe</em>.</blockquote><blockquote><strong>Tip</strong>: Use pgadmin to query the database, monitor performance, and backup or restore data as needed<em>.</em></blockquote><h3>Important Files Within a Custom Module</h3><p>When building your own module, you’ll interact with several important files. Let’s look at each of these:</p><h4>1. `__init__.py`</h4><ul><li>This file initializes your module. It imports your models, controllers, and other components.</li><li>Default Location in Windows: <em>C:\Program Files\Odoo 16\server\odoo\addon\&lt;your_custome_module&gt;\__init__.py</em></li></ul><h4>2. `__manifest__.py`</h4><ul><li>The manifest file describes your module and its dependencies. It defines metadata like the module’s name, version, author, and included files.</li><li>Default Location in Windows: <em>C:\Program Files\Odoo 16\server\odoo\addon\&lt;your_custome_module&gt;\__manifest__.py</em></li></ul><h4>3. `models/`</h4><ul><li>This directory contains Python files defining your data models and business logic.</li><li>Default Location in Windows: <em>C:\Program Files\Odoo 16\server\odoo\addon\&lt;your_custome_module&gt;\models\</em></li></ul><h4>4. `views/`</h4><ul><li>This folder stores XML files that define the user interface for your module, such as forms and list views.</li><li>Default Location in Windows: <em>C:\Program Files\Odoo 16\server\odoo\addon\&lt;your_custome_module&gt;\views\</em></li></ul><h4>5. `security/`</h4><ul><li>This folder manages access control and security rules.</li><li>Default Location in Windows: <em>C:\Program Files\Odoo 16\server\odoo\addon\&lt;your_custome_module&gt;\security</em></li></ul><h3>Final Thoughts</h3><p>With this Odoo tutorial for beginners, you now have a foundational understanding of the key files and folders within an Odoo installation.</p><p>Understanding Odoo’s directory structure and key files will make configuration and customization much simpler. With these insights, you can start creating and customizing your Odoo applications confidently.</p><p>Want to learn more? Check out our next guide on creating your first Odoo module!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40a57df66f7d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>