Odoo16迁移至Odoo18后网站CSS样式错乱且资源加载失败问题求助
Odoo16迁移至Odoo18后网站CSS样式错乱且资源加载失败问题求助
我把Odoo16的数据库迁移到本地的Odoo18虚拟环境后,网站虽然能打开,但CSS样式完全错乱,页面显示一团糟。浏览器控制台还弹出了这个错误:
Could not get content for /_custom/web.assets_frontend/website/static/src/scss/options/user_values.scss. web.assets_frontend_lazy.min.js:3966:395
对应的报错触发逻辑在web.assets_frontend_lazy.min.js的3966行附近,代码片段如下:
translationIsReady.then( () => { for (const asset of assets) { let cssRules; try { cssRules = asset.cssRules; } catch { continue; } const lastRule = cssRules?.[cssRules?.length - 1]; if (lastRule?.selectorText === 'css_error_message') { const message = _t( 'The style compilation failed. This is an administrator or developer error that must be fixed for the entire database before continuing working. See browser console or server logs for details.' ); notification.add(message, { title: _t('Style error'), sticky: true, type: 'danger', }); console.log( lastRule.style.content.replaceAll('\\a', '\n').replaceAll('\\*', '*').replaceAll(`\\"`, `"`) ); } } } ); }, };
网站样式错乱的实际显示效果:
我已经定位到报错里提到的user_values.scss文件,它在本地的路径是/Odoo18-virtualenv/src/community/addons/website/static/src/scss/options,但还是搞不懂为什么会出现资源加载失败的问题,也不知道该怎么修复样式错乱的情况,有没有大佬能帮忙指点一下?
备注:内容来源于stack exchange,提问作者Ahrimann Steiner




