Odoo v16: assets-frontend Error after uninstall custom module (migrated from v13)

651 views Asked by At

After my migration from Odoo v13 to v16, after having uninstalled a custom module (website_signup_info) which have only a crontroller.py and a js-file: signup.js, and no other nodule has this one in its dependance:

__manifest__.py of the custom module website_signup_info:

# -*- 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,
}    

After uninstalling it and going to the website, i got this Error concerning unreachable ASSETS FRONTEND:

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

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"/>

Any idea how to solve it ? Shall i remove the assets from database using SQL ?

1

There are 1 answers

0
theverygaming On BEST ANSWER

We encountered a similar problem while uninstalling an Odoo module (almost the same error, just with web.assets_backend, and Odoo v15.0 instead of v16.0). The Odoo install may have been migrated to Odoo v15.0 from an older version previously, but we are not sure.

The solution was to first reinstall the module (using the Odoo CLI) to get rid of the error, manually enable debug mode, go into Settings -> Technical -> Assets, find the related asset, and delete it. Then uninstall the module as usual. You could probably also remove the asset using SQL without reinstalling the module.

My guess why this happens is that Odoo once handled these assets differently, and while migrating, this was not accounted for. When uninstalling the module, the asset is not removed, which then causes this error.