Help

2

What mean theme.ir.ui.view ?

Avatar
Ramkumar

Tried creating a new theme in odoo v12.

Throwing error: odoo.tools.convert.ParseError: "theme.ir.ui.view"

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Customize header  -->
<template id="custom_header_new" inherit_id="website.layout" name="Custom Header New">

  <!-- Add an element after the top menu  -->
  <xpath expr="//div[@id='wrapwrap']/header/div" position="after">
    <div class="container">
      <div class="alert alert-info mt16" role="alert">
        <strong>Welcome</strong> in our website!
      </div>
    </div>
  </xpath>


</template>
</odoo>


Avatar
Discard
4 Answers
1
Best Answer

Mithul's answer was right, you must change to `portal.frontend_layout` and change `//div[@id='wrapwrap']/header/div` to `//div[@id='wrapwrap']/header/nav`.
Then you must add `website_theme_install` to your depends manifest.

Avatar
Discard
0
Avatar
Aishwarya
Best Answer

Same Error in Odoo13

​Error:
Odoo Server Error

Traceback (most recent call last):
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 713, in parse
self._tag_root(de)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 675, in _tag_root
f(rec)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 653, in _tag_template
return self._tag_record(record)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 491, in _tag_record
model = env[rec_model]
File "/opt/odoo13/odoo/odoo/api.py", line 471, in __getitem__
return self.registry[model_name]._browse(self, (), ())
File "/opt/odoo13/odoo/odoo/modules/registry.py", line 175, in __getitem__
return self.models[model_name]
KeyError: 'theme.ir.ui.view'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/opt/odoo13/odoo/odoo/http.py", line 619, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo13/odoo/odoo/http.py", line 309, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo13/odoo/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/opt/odoo13/odoo/odoo/http.py", line 664, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo13/odoo/odoo/http.py", line 345, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo13/odoo/odoo/service/model.py", line 93, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo13/odoo/odoo/http.py", line 338, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo13/odoo/odoo/http.py", line 909, in __call__
return self.method(*args, **kw)
File "/opt/odoo13/odoo/odoo/http.py", line 510, in response_wrap
response = f(*args, **kw)
File "/opt/odoo13/odoo/addons/web/controllers/main.py", line 1323, in call_button
action = self._call_kw(model, method, args, kwargs)
File "/opt/odoo13/odoo/addons/web/controllers/main.py", line 1311, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo13/odoo/odoo/api.py", line 395, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo13/odoo/odoo/api.py", line 382, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo13/odoo/addons/website_theme_install/models/ir_module_module.py", line 371, in button_refresh_theme
website.theme_id._theme_upgrade_upstream()
File "/opt/odoo13/odoo/addons/website_theme_install/models/ir_module_module.py", line 315, in _theme_upgrade_upstream
self._button_immediate_function(install_or_upgrade)
File "/opt/odoo13/odoo/odoo/addons/base/models/ir_module.py", line 573, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "/opt/odoo13/odoo/odoo/modules/registry.py", line 85, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "/opt/odoo13/odoo/odoo/modules/loading.py", line 416, in load_modules
force, status, report, loaded_modules, update_module, models_to_check)
File "/opt/odoo13/odoo/odoo/modules/loading.py", line 312, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "/opt/odoo13/odoo/odoo/modules/loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report)
File "/opt/odoo13/odoo/odoo/modules/loading.py", line 68, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 737, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 804, in convert_xml_import
obj.parse(doc.getroot())
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 722, in parse
exc_info[2]
File "/opt/odoo13/odoo/odoo/tools/pycompat.py", line 13, in reraise
raise value.with_traceback(tb)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 713, in parse
self._tag_root(de)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 675, in _tag_root
f(rec)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 653, in _tag_template
return self._tag_record(record)
File "/opt/odoo13/odoo/odoo/tools/convert.py", line 491, in _tag_record
model = env[rec_model]
File "/opt/odoo13/odoo/odoo/api.py", line 471, in __getitem__
return self.registry[model_name]._browse(self, (), ())
File "/opt/odoo13/odoo/odoo/modules/registry.py", line 175, in __getitem__
return self.models[model_name]
odoo.tools.convert.ParseError: "theme.ir.ui.view" while parsing /opt/odoo13/odoo/addons/theme_egweb/views/layout.xml:2, near
<odoo>
<!-- Customize header -->
</odoo>

Avatar
Discard
0
Best Answer

You all guys have part of reason. I've been struggling with the same issue for many hour until I found your question. I change all you said and it finally worked!! Thanks for that :) . I just want to punctualize these two points.

Then I've been taking a closer view and found you don't really have to change the inheritance to make it works. You can keep the inherit_id="website.layout", and actually you have the header inherited from portal.frontend_layout there. What you don't have is the div just after the header, so you have to search `//div[@id='wrapwrap']/header/nav` like suggested by Hendra.

The second and maybe more surprising, is that you need to specify the 'website_theme_install' app in your depends. Maybe that wasn't necesary in older versions, and I don't know why I had it installed by default but if you don't add it in your depends, you'll get another error (a different one than in the first case). This is not said in the Theme Tutorial in the Odoo Documentation and can make you lot of time checking your code.

Avatar
Discard
0
Avatar
Mitul Shingala
Best Answer

Hello,

the template you are try to inherit that is also the inherited template. and try to inherit with "//div[@id='wrapwrap']/header/div" so the template you inherit (website.layout) into that there is no any <header>. that's why you getting the parsing error. so try with inheriting the template "portal.frontend_layout" instead of "website.layout".

Thank you

1 Comment
Avatar
Discard
Avatar
Hendra R. Apriliyanto
-

I was tried your suggestion but the error still appear