Reputation: 9
Element '<t name="Sort-by Template" t-name="website_sale.sort">' cannot be located in parent view
View error context:
{'file': '/home/developer/Documents/odoo_16/Odoo/addons/website_sale/views/templates.xml',
'line': 1,
'name': 'Sort-by Template',
'view': ir.ui.view(1868,),
'view.model': False,
'view.parent': ir.ui.view(1866,),
'xmlid': 'products'}
tried deleting these records from databases but got another error.
Upvotes: 0
Views: 185
Reputation: 1314
It just means that, in your current version (v12?), you have created a new View (ir.ui.view(1868,)) that inherits the PARENT-View (inherit_id="website_sale.sort") whom xpath-hook is existing in your current version but doesn t exist anymore in your target version: Odoo v16.
To solve it accurately, you can replace the xpath-hook by one existing in the parent view in Odoo v16 (by inspecting its xml content).
To solve it quickly, you can disactivate or delete your view (id=1868).
My quick fix is using a pre-migrate.py file into one of my custom module : my_custom_module/migrations/16.0.0.0.0/pre-migrate.py which contain the Sql query that i need to execute, to correct the upgrade-log-Error:
def migrate(cr, version):
# TO CORRECT UPGRADE ERROR 1 : Element '<xpath expr="//xxxx">
# in ir.ui.view(1868,)' cannot be located in parent view
cr.execute("""
update ir_ui_view v
set inherit_id = NULL, mode='primary', active = false
where
v.id in (1868)
""")
Or, in case of multiple inherited-child-view, you can handle all the inherited views from the parent_id=1866 at the same time
def migrate(cr, version):
# TO CORRECT UPGRADE ERROR 1 : Element '<xpath expr="//xxxx">' cannot be located
# in parent view 'view.parent': ir.ui.view(1866,),
cr.execute("""
update ir_ui_view v
set inherit_id = NULL, mode='primary', active = false
where
v.inherit_id in (1866)
""")
Upvotes: 0