在我从 Odoo v13 迁移到 v16 后,卸载了一个自定义模块(website_signup_info)后,该模块只有一个 crontroller.py 和一个 js 文件:signup.js,并且没有其他结节具有此依赖项:
自定义模块 website_signup_info 的__manifest__.py
:
# -*- coding: utf-8 -*i-
{
'name': ' website_signup_info : handle custom fields in signup ',
'version': '13.0.2.0.20',
'category': 'Website',
'summary': """handle custom fields in signup """,
'description': "handle custom fields in signup ",
'depends': ['website','auth_signup','auth_oauth','portal'],
'assets':
{
'web.assets_frontend': [
'/website_signup_info/static/src/js/signup.js',
],
},
'installable': True,
}
卸载并访问网站后,我收到了有关无法访问资产前端的错误:
Error while render the template
Exception: Unallowed to fetch files from addon website_signup_info
Template: website.layout
Path: /t/html/head/t[3]
Node: <t t-call-assets="web.assets_frontend" t-js="false"/>
Error has occurred while rendering the model: website.layout
and evaluating the following expressions:
<t t-call-assets="web.assets_frontend" t-js="false"/>
追溯
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/tools/cache.py", line 85, in lookup
r = d[key]
File "<decorator-gen-8>", line 2, in __getitem__
File "/home/odoo/src/odoo/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/tools/lru.py", line 34, in __getitem__
a = self.d[obj]
KeyError: ('ir.qweb', <function IrQWeb._generate_asset_nodes_cache at 0x7efe48694790>, 'web.assets_frontend', True, False, '1', False, False, False, False, ('fr_FR', True, False, None, None, None, None, 1))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/tools/cache.py", line 85, in lookup
r = d[key]
File "<decorator-gen-8>", line 2, in __getitem__
File "/home/odoo/src/odoo/odoo/tools/func.py", line 87, in locked
return func(inst, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/tools/lru.py", line 34, in __getitem__
a = self.d[obj]
KeyError: ('ir.qweb', <function IrQWeb._get_asset_content at 0x7efe48694940>, 'web.assets_frontend', False, False, None, ('fr_FR', True, False, None, None, None, None, 1))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<462>", line 1742, in template_462
File "<462>", line 1205, in template_462_content
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_qweb.py", line 2450, in _load_values
return get_value()
File "<462>", line 1195, in template_462_t_cache_0_cache
File "<462>", line 159, in template_462_t_cache_0
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_qweb.py", line 2422, in _get_asset_nodes
return self._generate_asset_nodes_cache(bundle, css, js, debug, async_load, defer_load, lazy_load, media)
File "<decorator-gen-70>", line 2, in _generate_asset_nodes_cache
File "/home/odoo/src/odoo/odoo/tools/cache.py", line 90, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_qweb.py", line 2477, in _generate_asset_nodes_cache
return self._generate_asset_nodes(bundle, css, js, debug, async_load, defer_load, lazy_load, media)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_qweb.py", line 2548, in _generate_asset_nodes
files, remains = self._get_asset_content(bundle, defer_load=defer_load, lazy_load=lazy_load, media=css and media or None)
File "<decorator-gen-71>", line 2, in _get_asset_content
File "/home/odoo/src/odoo/odoo/tools/cache.py", line 90, in lookup
value = d[key] = self.method(*args, **kwargs)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_qweb.py", line 2481, in _get_asset_content
asset_paths = self.env['ir.asset']._get_asset_paths(bundle=bundle, css=True, js=True)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_asset.py", line 120, in _get_asset_paths
self._fill_asset_paths(bundle, addons, installed, css, js, asset_paths, [])
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_asset.py", line 210, in _fill_asset_paths
process_path(asset.directive, asset.target, asset.path)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_asset.py", line 169, in process_path
addon, paths = self._get_paths(path_def, installed, exts)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_asset.py", line 310, in _get_paths
raise Exception("Unallowed to fetch files from addon %s" % addon)
Exception: Unallowed to fetch files from addon website_signup_info
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/http.py", line 1589, in _serve_db
return service_model.retrying(self._serve_ir_http, self.env)
File "/home/odoo/src/odoo/odoo/service/model.py", line 133, in retrying
result = func()
File "/home/odoo/src/odoo/odoo/http.py", line 1616, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/home/odoo/src/odoo/odoo/http.py", line 1730, in dispatch
return self.request.registry['ir.http']._dispatch(endpoint)
File "/home/odoo/src/odoo/addons/website/models/ir_http.py", line 237, in _dispatch
response = super()._dispatch(endpoint)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 156, in _dispatch
result.flatten()
File "/home/odoo/src/odoo/odoo/http.py", line 1100, in flatten
self.response.append(self.render())
File "/home/odoo/src/odoo/odoo/http.py", line 1092, in render
return request.env["ir.ui.view"]._render_template(self.template, self.qcontext)
File "/home/odoo/src/odoo/addons/website/models/ir_ui_view.py", line 418, in _render_template
return super()._render_template(template, values=values)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_ui_view.py", line 2125, in _render_template
return self.env['ir.qweb']._render(template, values)
File "/home/odoo/src/odoo/odoo/tools/profiler.py", line 292, in _tracked_method_render
return method_render(self, template, values, **options)
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_qweb.py", line 581, in _render
result = ''.join(rendering)
File "<449>", line 39, in template_449
File "<449>", line 28, in template_449_content
File "<462>", line 1748, in template_462
odoo.addons.base.models.ir_qweb.QWebException:
Error while render the template
Exception: Unallowed to fetch files from addon website_signup_info
Template: website.layout
Path: /t/html/head/t[3]
Node: <t t-call-assets="web.assets_frontend" t-js="false"/>
L'erreur s'est produite lors du rendu du modèle website.layout et de l'évaluation des expressions suivantes : <t t-call-assets="web.assets_frontend" t-js="false"/>
知道如何解决吗? 我应该使用 SQL 从数据库中删除资产吗?
我们在卸载 Odoo 模块时遇到了类似的问题(几乎相同的错误,只是 web.assets_backend 和 Odoo v15.0 而不是 v16.0)。 Odoo 安装可能已从之前的旧版本迁移到 Odoo v15.0,但我们不确定。
解决方案是首先重新安装模块(使用 Odoo CLI)以消除错误,手动启用调试模式,进入设置 -> 技术 -> 资产,找到相关资产并将其删除。然后照常卸载模块。您或许还可以使用 SQL 删除资产,而无需重新安装模块。
我猜测为什么会发生这种情况,因为 Odoo 曾经以不同的方式处理这些资产,并且在迁移时没有考虑到这一点。卸载模块时,资产未被删除,从而导致此错误。