Skip to Content
Menu
This question has been flagged
3495 Views

Hi there,


I am quite new on Odoo and trying to discover how to use it with customise theme, modules and snippets etc.


I installed Odoo 14 to my mac via Docker. I'm following the tutorial below to create a new snippet:
https://www.odoo.com/documentation/14.0/howtos/themes.html#create-snippets


I created the snippet but I couldn't show it on Editor Bar.


This is the content of my snippets.xml file:

<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<template id="snippet_testimonial" name="R3GIS Test Snippet">
  <section class="snippet_testimonial">
    <div class="container text-center">
      <div class="row">
        <div class="col-lg-4">
          <img alt="client" class="rounded-circle" src="/theme_tutorial/static/src/img/client_1.jpg"/>
          <h3>Client Name</h3>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
        </div>
        <div class="col-lg-4">
          <img alt="client" class="rounded-circle" src="/theme_tutorial/static/src/img/client_2.jpg"/>
          <h3>Client Name</h3>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
        </div>
        <div class="col-lg-4">
          <img alt="client" class="rounded-circle" src="/theme_tutorial/static/src/img/client_3.jpg"/>
          <h3>Client Name</h3>
          <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
        </div>
      </div>
    </div>
  </section>
</template>
<template id="place_into_bar" inherit_id="website.snippets" name="Place into bar">
  <xpath expr="//div[@id='snippet_structure']/div[@class='o_panel_body']" position="inside">
    <t t-snippet="theme_tutorial.snippet_testimonial"
       t-thumbnail="/theme_tutorial/static/src/img/ui/snippet_thumb.jpg"/>
  </xpath>
</template>
</odoo> 

After I updated my theme, I click to Edit button on website in order to see the snippet into the Editor Bar, I get the error below: 

Odoo Server Error
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 682, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 358, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 346, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 911, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 530, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1359, in call_kw
    return self._call_kw(model, method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1351, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 392, in call_kw
    result = _call_kw_model(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/odoo/api.py", line 365, in _call_kw_model
    result = method(recs, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1691, in render_public_asset
    return template.sudo()._render(values, engine="ir.qweb")
  File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_ui_view.py", line 401, in _render
    return super(View, self)._render(values, engine=engine, minimal_qcontext=minimal_qcontext)
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_ui_view.py", line 28, in _render
    return super(IrUiView, self)._render(values=values, engine=engine, minimal_qcontext=minimal_qcontext)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_ui_view.py", line 1702, in _render
    return self.env[engine]._render(self.id, qcontext)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 55, in _render
    result = super(IrQWeb, self)._render(id_or_xml_id, values=values, **context)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 258, in _render
    self.compile(template, options)(self, body.append, values or {})
  File "<decorator-gen-66>", line 2, in compile
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_qweb.py", line 110, in compile
    return super(IrQWeb, self).compile(id_or_xml_id, options=options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 300, in compile
    raise QWebException("Error when compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 638, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/odoo/http.py", line 314, in _handle_exception
    raise exception.with_traceback(None) from new_cause
odoo.addons.base.models.qweb.QWebException: View 'theme_tutorial.snippet_testimonial' in website 1 not found
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
  File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
KeyError: ('ir.qweb', <function IrQWeb.compile at 0x7f3ddfb7a840>, 1056, ('en_US', None, None, None, None, 1))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
  File "/usr/lib/python3/dist-packages/odoo/tools/func.py", line 71, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
KeyError: ('ir.ui.view', <function View.get_view_id at 0x7f3ddcf628c8>, 2, True, 'theme_tutorial.snippet_testimonial', (1,))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 289, in compile
    body = self._compile_node(element, _options)
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 73, in _compile_node
    return super()._compile_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 653, in _compile_node
    return body + self._compile_directives(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 674, in _compile_directives
    return compile_handler(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 116, in _compile_directive_tag
    return super(QWeb, self)._compile_directive_tag(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 1007, in _compile_directive_tag
    content = self._compile_directives(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 674, in _compile_directives
    return compile_handler(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 1070, in _compile_directive_content
    body.extend(self._compile_node(item, options))
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 73, in _compile_node
    return super()._compile_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 644, in _compile_node
    return self._compile_static_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 800, in _compile_static_node
    content = self._compile_directive_content(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 1070, in _compile_directive_content
    body.extend(self._compile_node(item, options))
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 73, in _compile_node
    return super()._compile_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 644, in _compile_node
    return self._compile_static_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 800, in _compile_static_node
    content = self._compile_directive_content(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 1070, in _compile_directive_content
    body.extend(self._compile_node(item, options))
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 73, in _compile_node
    return super()._compile_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 644, in _compile_node
    return self._compile_static_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 800, in _compile_static_node
    content = self._compile_directive_content(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 1070, in _compile_directive_content
    body.extend(self._compile_node(item, options))
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 73, in _compile_node
    return super()._compile_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 644, in _compile_node
    return self._compile_static_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 800, in _compile_static_node
    content = self._compile_directive_content(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 1070, in _compile_directive_content
    body.extend(self._compile_node(item, options))
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 73, in _compile_node
    return super()._compile_node(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 653, in _compile_node
    return body + self._compile_directives(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 674, in _compile_directives
    return compile_handler(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 116, in _compile_directive_tag
    return super(QWeb, self)._compile_directive_tag(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 1007, in _compile_directive_tag
    content = self._compile_directives(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/base/models/qweb.py", line 674, in _compile_directives
    return compile_handler(el, options)
  File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_qweb.py", line 80, in _compile_directive_snippet
    view_id = View.get_view_id(key)
  File "<decorator-gen-161>", line 2, in get_view_id
  File "/usr/lib/python3/dist-packages/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_ui_view.py", line 323, in get_view_id
    raise ValueError('View %r in website %r not found' % (xml_id, self._context['website_id']))
ValueError: View 'theme_tutorial.snippet_testimonial' in website 1 not found

Error when compiling AST
ValueError: View 'theme_tutorial.snippet_testimonial' in website 1 not found
Template: website.snippets
Path: /t/div[3]/t/div[2]/div[2]/t[19]
Node: <t t-snippet="theme_tutorial.snippet_testimonial" t-thumbnail="/theme_tutorial/static/src/img/ui/snippet_thumb.jpg"/>


What should I do?

Avatar
Discard
Related Posts Replies Views Activity
1
Nov 24
1485
1
Nov 24
1193
2
Sep 24
1047
1
Aug 24
2454
3
Aug 24
2687