Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
258 Lượt xem

I'm currently working on a custom module in Odoo 18 (dev version) and ran into several warnings when starting the server and updating my module:


WARNING odoo.addons.base.models.ir_qweb: Unknown directives or unused attributes: {'t-call-assets', 't-js'} in web.webclient_bootstrap 
WARNING odoo.addons.base.models.ir_qweb: Unknown directives or unused attributes: {'t-call-assets'} in web.webclient_bootstrap
WARNING odoo.addons.base.models.ir_qweb: Unknown directives or unused attributes: {'t-call-assets'} in web.conditional_assets_tests
WARNING odoo.addons.base.models.ir_qweb: Found deprecated directive @t-esc="title or 'Odoo'" in template 180. Replace by @t-out
WARNING odoo.addons.base.models.ir_qweb: Found deprecated directive @t-esc='request.csrf_token(None)' in template 180. Replace by @t-out
WARNING odoo.addons.base.models.ir_qweb: Found deprecated directive @t-esc='debug' in template 180. Replace by @t-out

  • I'm using web_icon="estate,static/description/icon.png" in my menuitem.

  • I recently re-created the static directory after accidentally deleting it.

  • These warnings appear even after clearing the cache and restarting the server.

  • Dev mode is enabled.


Questions:

How should I correctly handle t-call-assets or avoid the warning if it's not meant to be used?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hello

Use "t-out" instead of "t-esc" to fix your mistake

if it doesn't work


try



<odoo>
  <data>
    <template
      id="my_module_assets_backend"
      inherit_id="web.assets_backend"
      name="My Module Web Assets">
      <xpath expr="." position="inside">
        <!-- your JS -->
        <script
          type="text/javascript"
          src="/my_module/static/src/js/my_script.js"/>
        <!-- your CSS -->
        <link
          rel="stylesheet"
          href="/my_module/static/src/css/my_style.css"/>
      </xpath>
    </template>
  </data>
</odoo>

Adding it to the web.assets_backend package



mainerror

Templates like web.webclient_bootstrap and web.conditional_assets_tests are treated as "normal" QWeb fragments, and here t-call-assets does not know what the t-js or t-css attributes mean, so it throws the error

end

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

Hey! Those warnings can be tricky. It sounds like you might need to double-check your template syntax, especially with the deprecated directives. Have you tried updating those @t-esc directives to @t-out as suggested? That might help clear up some of the warnings.

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 4 25
644
1
thg 4 25
227
2
thg 4 25
496
2
thg 12 24
662
0
thg 4 25
314