<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Thalen Viremont Viremont</title>
    <description>The latest articles on DEV Community by Thalen Viremont Viremont (@thalen_viremontviremont_).</description>
    <link>https://dev.to/thalen_viremontviremont_</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3330941%2Ff30e32eb-832b-4f6e-9034-751211cad446.png</url>
      <title>DEV Community: Thalen Viremont Viremont</title>
      <link>https://dev.to/thalen_viremontviremont_</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thalen_viremontviremont_"/>
    <language>en</language>
    <item>
      <title>401 or 500 errors with API integrations (REST/SOAP/OAuth) in Odoo. What are the causes and solutions?</title>
      <dc:creator>Thalen Viremont Viremont</dc:creator>
      <pubDate>Tue, 08 Jul 2025 05:38:39 +0000</pubDate>
      <link>https://dev.to/thalen_viremontviremont_/401-or-500-errors-with-api-integrations-restsoapoauth-in-odoo-what-are-the-causes-and-4jlc</link>
      <guid>https://dev.to/thalen_viremontviremont_/401-or-500-errors-with-api-integrations-restsoapoauth-in-odoo-what-are-the-causes-and-4jlc</guid>
      <description>&lt;h4&gt;
  
  
  ** Step 1:** Verify API Credentials
&lt;/h4&gt;

&lt;p&gt;Ensure OAuth tokens or API keys are correct and not expired.&lt;br&gt;
python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;response = requests.post(auth_url, data={'client_id': 'your_id', 'client_secret': 'your_secret'})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Step 2:&lt;/strong&gt; Check API Endpoint &amp;amp; HTTP Method
&lt;/h4&gt;

&lt;p&gt;Verify you're targeting the correct endpoint and using the correct HTTP method.&lt;br&gt;
Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;response = requests.get(url, headers={'Authorization': 'Bearer ' + token})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  ** Step 3: **Handle Response Codes
&lt;/h4&gt;

&lt;p&gt;Handle status codes correctly. A 401 Unauthorized indicates issues with the token or API credentials.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Step 4:&lt;/strong&gt; Error Logging
&lt;/h4&gt;

&lt;p&gt;Enable logging for troubleshooting.&lt;br&gt;
Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;_logger = logging.getLogger(__name__)
_logger.error("API Error: %s", response.text)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Step 5:&lt;/strong&gt; Test with External Tools
&lt;/h4&gt;

&lt;p&gt;Test the API with Postman or cURL to isolate the issue.&lt;br&gt;
Bash&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -X GET https://api.example.com/data -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;Step 6:&lt;/strong&gt; Retry Logic
&lt;/h4&gt;

&lt;p&gt;Add retry logic for intermittent failures.&lt;br&gt;
Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import time

def retry_request(url, retries=3, delay=5):
    for _ in range(retries):
        response = requests.get(url)
        if response.status_code == 200:
            return response.json()
        time.sleep(delay)
    raise Exception("API request failed")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://sdlccorp.com/services/odoo-services/odoo-implementation-services/" rel="noopener noreferrer"&gt;Odoo implementation&lt;/a&gt; requires more than just module installation—it demands strategic system integration to ensure seamless functionality across platforms. One of the most critical aspects is advanced API integration, supporting REST, SOAP, and OAuth protocols for secure and scalable data exchange.&lt;br&gt;
Successful implementations include robust handling of authentication flows, real-time synchronization of structured data sets, and comprehensive error management to maintain consistency and reduce operational risk. Whether integrating with CRMs, ERPs, payment gateways, or logistics systems, precise API mapping ensures that Odoo communicates reliably with third-party tools, enabling a unified tech ecosystem.&lt;br&gt;
By aligning custom endpoints, token-based security layers, and async job queues, businesses gain uninterrupted connectivity that scales with growth. This technical foundation not only improves interoperability but also optimizes workflow automation, data accuracy, and cross-platform performance—making the Odoo implementation resilient, future-ready, and tailored to complex enterprise needs.&lt;/p&gt;

</description>
      <category>api</category>
      <category>odooimplementation</category>
      <category>apiintegrations</category>
      <category>python</category>
    </item>
    <item>
      <title>Getting "Element not found" error with xpath in Odoo view. What's the cause and fix?</title>
      <dc:creator>Thalen Viremont Viremont</dc:creator>
      <pubDate>Mon, 07 Jul 2025 12:54:01 +0000</pubDate>
      <link>https://dev.to/thalen_viremontviremont_/getting-element-not-found-error-with-xpath-in-odoo-view-whats-the-cause-and-fix-4j97</link>
      <guid>https://dev.to/thalen_viremontviremont_/getting-element-not-found-error-with-xpath-in-odoo-view-whats-the-cause-and-fix-4j97</guid>
      <description>&lt;h2&gt;
  
  
  Step-by-Step Solution
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step 1:&lt;/strong&gt; Understand the Error
&lt;/h3&gt;

&lt;p&gt;The error means that your xpath is trying to match an element that does not exist in the view you are inheriting.&lt;br&gt;
 Wrong XPath Example:&lt;br&gt;
xml&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;xpath expr="//div[@name='button_box']" position="inside"&amp;gt;
    &amp;lt;button name="action_confirm" string="Confirm" type="object"/&amp;gt;
&amp;lt;/xpath&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;div[@name='button_box']&lt;/code&gt; is not present in the original view.&lt;/p&gt;

&lt;h3&gt;
  
  
  ** Step 2:** Locate the Correct Target View and XPath
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Activate Developer Mode in Odoo.&lt;/li&gt;
&lt;li&gt;Open the form view you're trying to modify.&lt;/li&gt;
&lt;li&gt;Click on "View → Edit View: Form".&lt;/li&gt;
&lt;li&gt;Look at the XML structure — find the correct element and its attributes (name, class, etc.).
Sample Existing View:
XML
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;field name="state" widget="statusbar" statusbar_visible="draft,confirmed"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You want to insert a button after this field.&lt;br&gt;
&lt;strong&gt;###  Step 3: Correct Inheritance View Code&lt;/strong&gt;&lt;br&gt;
Here’s how you properly inherit and insert a new button:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;record id="view_order_form_inherit" model="ir.ui.view"&amp;gt;
    &amp;lt;field name="name"&amp;gt;sale.order.form.inherit.button&amp;lt;/field&amp;gt;
    &amp;lt;field name="model"&amp;gt;sale.order&amp;lt;/field&amp;gt;
    &amp;lt;field name="inherit_id" ref="sale.view_order_form"/&amp;gt;
    &amp;lt;field name="arch" type="xml"&amp;gt;
        &amp;lt;xpath expr="//header" position="inside"&amp;gt;
            &amp;lt;button name="custom_action"
                    string="Custom Button"
                    type="object"
                   class="btn btn-primary"/&amp;gt;
        &amp;lt;/xpath&amp;gt;
    &amp;lt;/field&amp;gt;
&amp;lt;/record&amp;gt;``
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;-&lt;code&gt;inherit_id&lt;/code&gt; refers to the original view.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;xpath targets the &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt; tag.&lt;/li&gt;
&lt;li&gt;Button is inserted inside header using &lt;code&gt;position="inside"&lt;/code&gt;.
&lt;strong&gt;### Step 4: Add Python Method&lt;/strong&gt;
In your model (sale.order), define the action:
Python
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;from odoo import models

class SaleOrder(models.Model):
    _inherit = 'sale.order'

    def custom_action(self):
        # your logic here
        return {
            'type': 'ir.actions.client',
            'tag': 'display_notification',
            'params': {
                'title': 'Custom Button Clicked',
                'type': 'success',
                'message': 'This is a custom action.',
                'sticky': False,
            }
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Upgrade the Module
&lt;/h3&gt;

&lt;p&gt;After editing XML and Python:&lt;br&gt;
Bash&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ odoo -u your_module_name -d your_database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or use Odoo UI:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Apps → Update Apps List → Upgrade your module.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In &lt;a href="https://sdlccorp.com/services/odoo-services/odoo-implementation-services/" rel="noopener noreferrer"&gt;Odoo implementation&lt;/a&gt;, when working with XPath in views, issues can occur when the target elements do not exist in the original XML, resulting in errors like "Element not found." This typically happens when the XPath expression fails to match the structure of the inherited view. To resolve this, ensure the XPath expression accurately references an existing element and verify the correct view inheritance. Additionally, it's crucial to use precise XPath expressions that target elements based on their attributes or position in the view hierarchy, ensuring smooth customization and extension of Odoo's default views.&lt;/p&gt;

</description>
      <category>odooimplementation</category>
      <category>xpath</category>
      <category>python</category>
      <category>xml</category>
    </item>
    <item>
      <title>What causes a 'View Error: Element not found' during XML view inheritance using XPath in Odoo?"</title>
      <dc:creator>Thalen Viremont Viremont</dc:creator>
      <pubDate>Mon, 07 Jul 2025 11:53:46 +0000</pubDate>
      <link>https://dev.to/thalen_viremontviremont_/what-causes-a-view-error-element-not-found-during-xml-view-inheritance-using-xpath-in-odoo-49ak</link>
      <guid>https://dev.to/thalen_viremontviremont_/what-causes-a-view-error-element-not-found-during-xml-view-inheritance-using-xpath-in-odoo-49ak</guid>
      <description>&lt;p&gt;This error typically occurs when the XPath expression used in the XML view does not match any element in the target view. Odoo fails to locate the element you are trying to extend, so the system throws a&lt;code&gt;View error: Element not found.&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Step-by-Step Solution&lt;/strong&gt;:
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. Understand the View You're Inheriting:
&lt;/h4&gt;

&lt;p&gt;Before writing an XPath expression, inspect the original view you're modifying. You can do this in Odoo:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Activate Developer Mode&lt;/li&gt;
&lt;li&gt;Go to the form or tree view → Click "View → Edit View: Form/Tree"&lt;/li&gt;
&lt;li&gt;Review the XML to see available field names or structure
Problematic Code Example:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;record id="inherit_res_partner_form" model="ir.ui.view"&amp;gt;
    &amp;lt;field name="name"&amp;gt;res.partner.form.inherit&amp;lt;/field&amp;gt;
    &amp;lt;field name="model"&amp;gt;res.partner&amp;lt;/field&amp;gt;
    &amp;lt;field name="inherit_id" ref="base.view_partner_form"/&amp;gt;
    &amp;lt;field name="arch" type="xml"&amp;gt;
        &amp;lt;xpath expr="//field[@name='non_existing_field']" position="after"&amp;gt;
            &amp;lt;field name="custom_field"/&amp;gt;
        &amp;lt;/xpath&amp;gt;
    &amp;lt;/field&amp;gt;
&amp;lt;/record&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Issue&lt;/strong&gt;: &lt;code&gt;non_existing_field&lt;/code&gt; does not exist in the inherited view, so Odoo cannot apply the modification.&lt;br&gt;
 Corrected Code Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;record id="inherit_res_partner_form" model="ir.ui.view"&amp;gt;
    &amp;lt;field name="name"&amp;gt;res.partner.form.inherit&amp;lt;/field&amp;gt;
    &amp;lt;field name="model"&amp;gt;res.partner&amp;lt;/field&amp;gt;
    &amp;lt;field name="inherit_id" ref="base.view_partner_form"/&amp;gt;
    &amp;lt;field name="arch" type="xml"&amp;gt;
        &amp;lt;xpath expr="//field[@name='phone']" position="after"&amp;gt;
            &amp;lt;field name="custom_field"/&amp;gt;
        &amp;lt;/xpath&amp;gt;
    &amp;lt;/field&amp;gt;
&amp;lt;/record&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Fix:&lt;/strong&gt; Here, we’re inserting after the &lt;code&gt;phone&lt;/code&gt; field, which is known to exist in the original view.&lt;br&gt;
&lt;a href="https://sdlccorp.com/services/odoo-services/odoo-customization-services/" rel="noopener noreferrer"&gt;Odoo customization&lt;/a&gt;, the 'ViewError: Element not found' typically occurs during XML view inheritance when the XPath expression fails to locate the target element within the original view. This can happen due to incorrect model inheritance, misdefined field names, or an improper XPath that doesn’t align with the view structure. Odoo’s customization framework allows for modifications at the model and view levels, using Python for model overrides and XML for view adjustments. Resolving this error requires a thorough understanding of Odoo’s ORM, the XML structure of the base view, and the correct use of XPath expressions to ensure precise inheritance and customization.&lt;/p&gt;

</description>
      <category>odoo</category>
      <category>odoocustomization</category>
      <category>xml</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>Thalen Viremont Viremont</dc:creator>
      <pubDate>Mon, 07 Jul 2025 11:43:51 +0000</pubDate>
      <link>https://dev.to/thalen_viremontviremont_/-2l8f</link>
      <guid>https://dev.to/thalen_viremontviremont_/-2l8f</guid>
      <description></description>
    </item>
    <item>
      <title>Why are changes to an overridden Odoo model not reflecting in the system?</title>
      <dc:creator>Thalen Viremont Viremont</dc:creator>
      <pubDate>Mon, 07 Jul 2025 10:52:04 +0000</pubDate>
      <link>https://dev.to/thalen_viremontviremont_/why-are-changes-to-an-overridden-odoo-model-not-reflecting-in-the-system-2dcp</link>
      <guid>https://dev.to/thalen_viremontviremont_/why-are-changes-to-an-overridden-odoo-model-not-reflecting-in-the-system-2dcp</guid>
      <description>&lt;h2&gt;
  
  
  &lt;strong&gt;Answer with Step-by-Step Guide:&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Understand the Purpose of _inherit and _name&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;_name&lt;/strong&gt; defines a new model.&lt;/li&gt;
&lt;li&gt;- &lt;strong&gt;_inherit&lt;/strong&gt; is used to extend or override an existing model
If both are used incorrectly together, you might unintentionally create a new model instead of overriding an existing one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# models/product_extension.py
from odoo import models, fields
class ProductTemplate(models.Model):
    _name = 'product.template'     # ❌ This will redefine a new model, not extend!
    _inherit = 'product.template'  # ❌ Using _name and _inherit same = bad override
    custom_field = fields.Char(string="Custom Field")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
 Problem: This creates a new conflicting model instead of extending the existing product.template.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Use Only _inherit to Extend Existing Model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# models/product_extension.py
from odoo import models, fields

class ProductTemplate(models.Model):
    _inherit = 'product.template'  # ✅ Correct way to extend existing model
    custom_field = fields.Char(string="Custom Field")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result: This adds custom_field to the product.template model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Use _name Only When Creating a New Model&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# models/my_custom_model.py
from odoo import models, fields
class MyCustomModel(models.Model):
    _name = 'my.custom.model'  # ✅ New model name
    name = fields.Char(string="Name")
    active = fields.Boolean(default=True)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Tip:&lt;/strong&gt; Avoid using the same _name as any core model unless you're sure you're replacing it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Check Model Registration&lt;/strong&gt;&lt;br&gt;
After defining your model, ensure it is registered in &lt;strong&gt;init&lt;/strong&gt;.py and added to &lt;strong&gt;manifest&lt;/strong&gt;.py&lt;br&gt;
Python&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# __init__.py
from . import models
# models/__init__.py
from . import product_extension
# __manifest__.py
'depends': ['base', 'product'],  # product dependency is important if extending product.template
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5: Upgrade the Module Properly&lt;/strong&gt;&lt;br&gt;
Run the following to upgrade and reflect the changes:&lt;/p&gt;

&lt;p&gt;Bash&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;odoo -u your_module_name -d your_database
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or from UI:&lt;br&gt;
Go to Apps → Update App List → Upgrade your module.&lt;br&gt;
When changes made to an overridden Odoo model do not reflect in the system, the issue typically stems from improper model inheritance, misconfigured field references, or missing XML updates in the view structure. &lt;a href="https://sdlccorp.com/services/odoo-services/odoo-customization-services/" rel="noopener noreferrer"&gt;Odoo customization&lt;/a&gt; involves extending the core ERP framework by modifying models, views, and workflows, often through custom modules and Python code. Common pitfalls in this process include using incorrect XPath expressions in inherited views, failing to trigger module updates after changes, or conflicts in model inheritance that prevent proper loading. Ensuring accurate overrides requires a clear understanding of Odoo's ORM, view inheritance mechanism, and database updates through module reloads and cache clearing.&lt;/p&gt;

</description>
      <category>odoo</category>
      <category>odoomodel</category>
      <category>odoocustomization</category>
    </item>
  </channel>
</rss>
