最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Odoo 16 External ID not found in the system: website.assets_frontend - Stack Overflow

programmeradmin6浏览0评论

I'm kinda new to Odoo and I want to make my own odoo module snippet. But when I try to activate my snippet, I'm getting this error:

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/Users/scripty/Downloads/odoo/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
        ~^^^^^
  File "<decorator-gen-8>", line 2, in __getitem__
  File "/Users/scripty/Downloads/odoo/odoo/tools/func.py", line 87, in locked
    return func(inst, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
        ~~~~~~^^^^^
KeyError: ('ir.model.data', <function IrModelData._xmlid_lookup at 0x106f9cb80>, 'website.assets_frontend')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 698, in _tag_root
    f(rec)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 676, in _tag_template
    return self._tag_record(record)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 568, in _tag_record
    f_val = self.id_get(f_ref, raise_if_not_found=nodeattr2bool(rec, 'forcecreate', True))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 681, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 687, in model_id_get
    return self.env['ir.model.data']._xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_model.py", line 2059, in _xmlid_to_res_model_res_id
    return self._xmlid_lookup(xmlid)[1:3]
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-43>", line 2, in _xmlid_lookup
  File "/Users/scripty/Downloads/odoo/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_model.py", line 2052, in _xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: website.assets_frontend

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

Traceback (most recent call last):
  File "/Users/scripty/Downloads/odoo/odoo/http.py", line 1653, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
             ^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/http.py", line 1680, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/http.py", line 1884, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/addons/website/models/ir_http.py", line 237, in _dispatch
    response = super()._dispatch(endpoint)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/http.py", line 734, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/addons/web/controllers/dataset.py", line 46, in call_button
    action = self._call_kw(model, method, args, kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-77>", line 2, in button_immediate_install
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_module.py", line 478, in button_immediate_install
    return self._button_immediate_function(self.env.registry[self._name].button_install)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_module.py", line 602, in _button_immediate_function
    registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-16>", line 2, in new
  File "/Users/scripty/Downloads/odoo/odoo/tools/func.py", line 87, in locked
    return func(inst, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/Users/scripty/Downloads/odoo/odoo/modules/loading.py", line 489, in load_modules
    processed_modules += load_marked_modules(cr, graph,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/modules/loading.py", line 373, in load_marked_modules
    loaded, processed = load_module_graph(
                        ^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/modules/loading.py", line 232, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package)
  File "/Users/scripty/Downloads/odoo/odoo/modules/loading.py", line 72, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 763, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 829, in convert_xml_import
    obj.parse(doc.getroot())
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 749, in parse
    self._tag_root(de)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 698, in _tag_root
    f(rec)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 711, in _tag_root
    raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
odoo.tools.convert.ParseError: while parsing None:4, somewhere inside
<data inherit_id="website.assets_frontend" name="Custom Snippet Assets">
            <xpath expr="." position="inside">
                <link rel="stylesheet" type="text/css" href="/snippet_scripty/static/src/css/custom_snippet.css"/>
            </xpath>
        </data>

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPCError@http://localhost:8069/web/assets/2625-5089ccf/web.assets_backend.min.js:997:274
    makeErrorFromResponse@http://localhost:8069/web/assets/2625-5089ccf/web.assets_backend.min.js:1001:163
    jsonrpc/promise</<@http://localhost:8069/web/assets/2625-5089ccf/web.assets_backend.min.js:1009:34
    

I honestly don't know what is going on. Says that website.assets_frontend is not found.

This is what I have on my assets.xml file:

<odoo>
    <data>
        <!-- Ensure the frontend assets are correctly referenced -->
        <template id="custom_snippet_assets" inherit_id="website.assets_frontend" name="Custom Snippet Assets">
            <xpath expr="." position="inside">
                <link rel="stylesheet" type="text/css" href="/snippet_scripty/static/src/css/custom_snippet.css"/>
            </xpath>
        </template>
        <!-- Ensure the editor assets are correctly referenced -->
        <template id="custom_snippet_assets_editor" inherit_id="website.assets_editor" name="Custom Snippet Assets Editor">
            <xpath expr="." position="inside">
                <link rel="stylesheet" type="text/css" href="/snippet_scripty/static/src/css/custom_snippet.css"/>
            </xpath>
        </template>
    </data>
</odoo>

On my manifest, I just have this:

{
    'name': 'Snippet Scripty',
    'version': '1',
    'summary': 'Custom snippet made by scripty',
    'description': 'Custom snippet made by scripty',
    'category': 'Website',
    'depends': ['website'],
    'data': [
        'views/assets.xml',
        'xml/custom_snippet_templates.xml',
    ],
    'assets': {
        'web.assets_frontend': [
            '/snippet_scripty/static/src/css/custom_snippet.css',
        ],
        'web.assets_editor': [
            '/snippet_scripty/static/src/css/custom_snippet.css',
        ],
    },
    'installable': True,
    'application': False,
}

I was expected to have my snippet appear on the website editor and have it normally activated. But I get that error when I even try to activate the module

I'm kinda new to Odoo and I want to make my own odoo module snippet. But when I try to activate my snippet, I'm getting this error:

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/Users/scripty/Downloads/odoo/odoo/tools/cache.py", line 85, in lookup
    r = d[key]
        ~^^^^^
  File "<decorator-gen-8>", line 2, in __getitem__
  File "/Users/scripty/Downloads/odoo/odoo/tools/func.py", line 87, in locked
    return func(inst, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/tools/lru.py", line 34, in __getitem__
    a = self.d[obj]
        ~~~~~~^^^^^
KeyError: ('ir.model.data', <function IrModelData._xmlid_lookup at 0x106f9cb80>, 'website.assets_frontend')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 698, in _tag_root
    f(rec)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 676, in _tag_template
    return self._tag_record(record)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 568, in _tag_record
    f_val = self.id_get(f_ref, raise_if_not_found=nodeattr2bool(rec, 'forcecreate', True))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 681, in id_get
    res = self.model_id_get(id_str, raise_if_not_found)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 687, in model_id_get
    return self.env['ir.model.data']._xmlid_to_res_model_res_id(id_str, raise_if_not_found=raise_if_not_found)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_model.py", line 2059, in _xmlid_to_res_model_res_id
    return self._xmlid_lookup(xmlid)[1:3]
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-43>", line 2, in _xmlid_lookup
  File "/Users/scripty/Downloads/odoo/odoo/tools/cache.py", line 90, in lookup
    value = d[key] = self.method(*args, **kwargs)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_model.py", line 2052, in _xmlid_lookup
    raise ValueError('External ID not found in the system: %s' % xmlid)
ValueError: External ID not found in the system: website.assets_frontend

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

Traceback (most recent call last):
  File "/Users/scripty/Downloads/odoo/odoo/http.py", line 1653, in _serve_db
    return service_model.retrying(self._serve_ir_http, self.env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/service/model.py", line 133, in retrying
    result = func()
             ^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/http.py", line 1680, in _serve_ir_http
    response = self.dispatcher.dispatch(rule.endpoint, args)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/http.py", line 1884, in dispatch
    result = self.request.registry['ir.http']._dispatch(endpoint)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/addons/website/models/ir_http.py", line 237, in _dispatch
    response = super()._dispatch(endpoint)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_http.py", line 154, in _dispatch
    result = endpoint(**request.params)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/http.py", line 734, in route_wrapper
    result = endpoint(self, *args, **params_ok)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/addons/web/controllers/dataset.py", line 46, in call_button
    action = self._call_kw(model, method, args, kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/addons/web/controllers/dataset.py", line 33, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/api.py", line 468, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/api.py", line 453, in _call_kw_multi
    result = method(recs, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-77>", line 2, in button_immediate_install
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_module.py", line 478, in button_immediate_install
    return self._button_immediate_function(self.env.registry[self._name].button_install)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/addons/base/models/ir_module.py", line 602, in _button_immediate_function
    registry = modules.registry.Registry.new(self._cr.dbname, update_module=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<decorator-gen-16>", line 2, in new
  File "/Users/scripty/Downloads/odoo/odoo/tools/func.py", line 87, in locked
    return func(inst, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/modules/registry.py", line 87, in new
    odoo.modules.load_modules(registry, force_demo, status, update_module)
  File "/Users/scripty/Downloads/odoo/odoo/modules/loading.py", line 489, in load_modules
    processed_modules += load_marked_modules(cr, graph,
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/modules/loading.py", line 373, in load_marked_modules
    loaded, processed = load_module_graph(
                        ^^^^^^^^^^^^^^^^^^
  File "/Users/scripty/Downloads/odoo/odoo/modules/loading.py", line 232, in load_module_graph
    load_data(cr, idref, mode, kind='data', package=package)
  File "/Users/scripty/Downloads/odoo/odoo/modules/loading.py", line 72, in load_data
    tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 763, in convert_file
    convert_xml_import(cr, module, fp, idref, mode, noupdate)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 829, in convert_xml_import
    obj.parse(doc.getroot())
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 749, in parse
    self._tag_root(de)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 698, in _tag_root
    f(rec)
  File "/Users/scripty/Downloads/odoo/odoo/tools/convert.py", line 711, in _tag_root
    raise ParseError('while parsing %s:%s, somewhere inside\n%s' % (
odoo.tools.convert.ParseError: while parsing None:4, somewhere inside
<data inherit_id="website.assets_frontend" name="Custom Snippet Assets">
            <xpath expr="." position="inside">
                <link rel="stylesheet" type="text/css" href="/snippet_scripty/static/src/css/custom_snippet.css"/>
            </xpath>
        </data>

The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
    RPCError@http://localhost:8069/web/assets/2625-5089ccf/web.assets_backend.min.js:997:274
    makeErrorFromResponse@http://localhost:8069/web/assets/2625-5089ccf/web.assets_backend.min.js:1001:163
    jsonrpc/promise</<@http://localhost:8069/web/assets/2625-5089ccf/web.assets_backend.min.js:1009:34
    

I honestly don't know what is going on. Says that website.assets_frontend is not found.

This is what I have on my assets.xml file:

<odoo>
    <data>
        <!-- Ensure the frontend assets are correctly referenced -->
        <template id="custom_snippet_assets" inherit_id="website.assets_frontend" name="Custom Snippet Assets">
            <xpath expr="." position="inside">
                <link rel="stylesheet" type="text/css" href="/snippet_scripty/static/src/css/custom_snippet.css"/>
            </xpath>
        </template>
        <!-- Ensure the editor assets are correctly referenced -->
        <template id="custom_snippet_assets_editor" inherit_id="website.assets_editor" name="Custom Snippet Assets Editor">
            <xpath expr="." position="inside">
                <link rel="stylesheet" type="text/css" href="/snippet_scripty/static/src/css/custom_snippet.css"/>
            </xpath>
        </template>
    </data>
</odoo>

On my manifest, I just have this:

{
    'name': 'Snippet Scripty',
    'version': '1',
    'summary': 'Custom snippet made by scripty',
    'description': 'Custom snippet made by scripty',
    'category': 'Website',
    'depends': ['website'],
    'data': [
        'views/assets.xml',
        'xml/custom_snippet_templates.xml',
    ],
    'assets': {
        'web.assets_frontend': [
            '/snippet_scripty/static/src/css/custom_snippet.css',
        ],
        'web.assets_editor': [
            '/snippet_scripty/static/src/css/custom_snippet.css',
        ],
    },
    'installable': True,
    'application': False,
}

I was expected to have my snippet appear on the website editor and have it normally activated. But I get that error when I even try to activate the module

Share Improve this question asked Jan 18 at 16:44 scriptyscripty 111 silver badge1 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 1

You're loading the assets in both ways, the old and the new way. The new way by adding the assets in the manifest by key assets should be enough. No data xml needed anymore.

发布评论

评论列表(0)

  1. 暂无评论