Skip to Content
Odoo Menu
  • Sign in
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    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 Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & 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
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

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

  • CRM
  • e-Commerce
  • Accounting
  • Inventory
  • PoS
  • Project
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Tags (View all)
odoo accounting v14 pos v15
About this forum
Help

Element '<xpath expr="//div[@data-key=&#39;hr&#39;]//div[hasclass(&#39;o_settings_container&#39;)]">' cannot be located in parent view of Odoo17

Subscribe

Get notified when there's activity on this post

This question has been flagged
3 Replies
5626 Views
Avatar
Cruz

Seeking guidance on how to fix the below error. Any suggestions?

Traceback (most recent call last): File "/opt/odoo17/odoo/odoo/http.py", line 1722, in _serve_db return service_model.retrying(self._serve_ir_http, self.env) File "/opt/odoo17/odoo/odoo/service/model.py", line 133, in retrying result = func() File "/opt/odoo17/odoo/odoo/http.py", line 1749, in _serve_ir_http response = self.dispatcher.dispatch(rule.endpoint, args) File "/opt/odoo17/odoo/odoo/http.py", line 1953, in dispatch result = self.request.registry['ir.http']._dispatch(endpoint) File "/opt/odoo17/odoo/addons/website/models/ir_http.py", line 235, in _dispatch response = super()._dispatch(endpoint) File "/opt/odoo17/odoo/odoo/addons/base/models/ir_http.py", line 222, in _dispatch result = endpoint(**request.params) File "/opt/odoo17/odoo/odoo/http.py", line 722, in route_wrapper result = endpoint(self, *args, **params_ok) File "/opt/odoo17/odoo/addons/web/controllers/dataset.py", line 28, in call_button action = self._call_kw(model, method, args, kwargs) File "/opt/odoo17/odoo/addons/web/controllers/dataset.py", line 20, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/opt/odoo17/odoo/odoo/api.py", line 466, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/opt/odoo17/odoo/odoo/api.py", line 453, in _call_kw_multi result = method(recs, *args, **kwargs) File "", line 2, in button_immediate_install File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 75, in check_and_log return method(self, *args, **kwargs) File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 459, in button_immediate_install return self._button_immediate_function(type(self).button_install) File "/opt/odoo17/odoo/odoo/addons/base/models/ir_module.py", line 583, in _button_immediate_function registry = modules.registry.Registry.new(self._cr.dbname, update_module=True) File "", line 2, in new File "/opt/odoo17/odoo/odoo/tools/func.py", line 87, in locked return func(inst, *args, **kwargs) File "/opt/odoo17/odoo/odoo/modules/registry.py", line 113, in new odoo.modules.load_modules(registry, force_demo, status, update_module) File "/opt/odoo17/odoo/odoo/modules/loading.py", line 480, in load_modules processed_modules += load_marked_modules(env, graph, File "/opt/odoo17/odoo/odoo/modules/loading.py", line 364, in load_marked_modules loaded, processed = load_module_graph( File "/opt/odoo17/odoo/odoo/modules/loading.py", line 227, in load_module_graph load_data(env, idref, mode, kind='data', package=package) File "/opt/odoo17/odoo/odoo/modules/loading.py", line 71, in load_data tools.convert_file(env, package.name, filename, idref, mode, noupdate, kind) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 627, in convert_file convert_xml_import(env, module, fp, idref, mode, noupdate) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 693, in convert_xml_import obj.parse(doc.getroot()) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 613, in parse self._tag_root(de) File "/opt/odoo17/odoo/odoo/tools/convert.py", line 567, in _tag_root raise ParseError(msg) from None # Restart with "--log-handler odoo.tools.convert:DEBUG" for complete traceback odoo.tools.convert.ParseError: while parsing /opt/odoo17/odoo/addons/gb_hr_employee_updation/views/updation_config.xml:3 Error while parsing or validating view: Element '' cannot be located in parent view View error context: {'file': '/opt/odoo17/odoo/addons/gb_hr_employee_updation/views/updation_config.xml', 'line': 2, 'name': 'journal.res.config.settings.view.form.inherit.hr.fleet', 'view': ir.ui.view(3798,), 'view.model': 'res.config.settings', 'view.parent': ir.ui.view(176,), 'xmlid': 'journal_config_settings_view_form'}


0
Avatar
Discard
Avatar
Cruz
Author Best Answer

I just solved it, by changing the code to
<xpath expr="//form" position="inside">
Now it is working fine.

0
Avatar
Discard
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Best Answer

Hi,

In odoo 17 there is so many changes had occurred inside res config settings. So make clear that you are xpathing the correct location

example:

<record id="res_config_settings_view_form" model="ir.ui.view">
<field name="model">res.config.settings</field>
        <field name="inherit_id"
ref="base_setup.res_config_settings_view_form"/>
        <field name="arch" type="xml">
<xpath expr="//setting[@id='mail_templates_setting']"
                   position="after">
                <setting id="company_share_product"
                         string="Inter Company features"
                         help="Automatically generate counterpart documents for orders/invoices between companies "
                         company_dependent="1">
                    <div class="content-group">
                        <div class="mt16">
                            <field name="company_share_product"/>
                            <label string="Common Product Catalog"
                                   for="company_share_product" class="o_light_label"/>
                        </div>
                    </div>
                </setting>

       </xpath>

</field>

</record>


The above is just an example, please provide your correct settings id in Xpath


Hope it helps

0
Avatar
Discard
Cruz
Author

I just solved it, by changing the code to
<xpath expr="//form" position="inside">
Now it is working fine.

Avatar
Vikas Jadav
Best Answer


Hello,

Try following code instead.

Mark it as answer or upvote if it's helpful, Thanks.


field name="arch" type="xml">

    xpath expr="//block[@name='employees_setting_container']" position="after">

        block title="block_title" id="block_id">

            setting string="Custom Setting" id="setting_id" title="your title.">

                field name="field_name"/>

            /setting>

        /block>

    /xpath>

/field>

0
Avatar
Discard
Cruz
Author

Hi Vikas,
I was not able to view your code

Vikas Jadav

Updated it.
I think odoo does not let me add < so removed it.

Cruz
Author

Okay Vikas, now the code is visible. But my existing code is below.

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="journal_config_settings_view_form" model="ir.ui.view">
<field name="name">journal.res.config.settings.view.form.inherit.hr.fleet</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="90"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@data-key='hr']//div[hasclass('o_settings_container')]" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="notice_period"/>
</div>
<div class="o_setting_right_pane">
<label for="notice_period"/>
<div class="content-group" attrs="{'invisible': [('notice_period', '=', False)]}">
<div class="mt16">
<field name="no_of_days" style="width:50px;"/>
<span>days</span>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>
So how can i change this code in accordance with yours.

Cruz
Author

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="journal_config_settings_view_form" model="ir.ui.view">
<field name="name">journal.res.config.settings.view.form.inherit.hr.fleet</field>
<field name="model">res.config.settings</field>
<field name="priority" eval="90"/>
<field name="inherit_id" ref="base.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//div[@data-key='hr']//div[hasclass('o_settings_container')]" position="inside">
<div class="col-12 col-lg-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="notice_period"/>
</div>
<div class="o_setting_right_pane">
<label for="notice_period"/>
<div class="content-group" attrs="{'invisible': [('notice_period', '=', False)]}">
<div class="mt16">
<field name="no_of_days" style="width:50px;"/>
<span>days</span>
</div>
</div>
</div>
</div>
</xpath>
</field>
</record>
</odoo>

What adjustments should be made to this code to fix the error?

Vikas Jadav


<record id="journal_config_settings_view_form" model="ir.ui.view">
<field name="name">res.config.settings.view.form.inherit.hr.fleet</field>
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="hr.res_config_settings_view_form"/>
<field name="arch" type="xml">
<xpath expr="//block[@name='employees_setting_container']" position="after">
<block title="Contract" id="hr_contract">
<setting string="Notice Period" id="notice_period_setting">
<div class="content-group">
<div class="mt16">
<label string="Notice Period" for="notice_period" class="o_light_label"/>
</div>
<div>
<field name="notice_period"/>
<span>Days</span>
</div>
</div>
</setting>
</block>
</xpath>
</field>
</record>

Enjoying the discussion? Don't just read, join in!

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

Sign up
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة 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 is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

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