odoo网站登录时的错误及处理方案

在使用客户发来的数据库进行本地开发环境搭建的时候碰到登录时加载CSS问题失败的问题:

1
2
Could not get content for /website/static/src/scss/options/user_values.custom.web.assets_common.scss defined in bundle 'web.assets_common'.
Could not get content for /website/static/src/scss/options/colors/user_theme_color_palette.custom.web.assets_common.scss defined in bundle 'web.assets_common'.

从报错提示上看是缺少scss文件而导致的, 但是从数据库附件目录中却可以找到这个文件,而且可以正常下载,虽然内容是空的。但这说明问题的根源并非找不到文件。

然后我们打开浏览带的console界面,发现提示website模块并没有正常加载。

然后我们使用-u命令试图升级website模块, 但是在后台发现了如下错误:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/codes/projects/odoo/odoo-14.0/odoo/addons/base/models/qweb.py", line 331, in _compiled_fn
return compiled(self, append, new, options, log)
File "<template>", line 1, in template_web_login_layout_19
File "/root/codes/projects/odoo/odoo-14.0/odoo/addons/base/models/qweb.py", line 338, in _compiled_fn
raise QWebException("Error to render compiling AST", e, path, node and etree.tostring(node[0], encoding='unicode'), name)
File "/root/codes/projects/odoo/odoo-14.0/odoo/addons/base/models/qweb.py", line 144, in __init__
self.message = "%s\n%s: %s" % (self.message, self.error.__class__.__name__, self.error)
File "/usr/local/lib/python3.8/dist-packages/werkzeug/routing.py", line 307, in __str__
if self.suggested:
File "/usr/local/lib/python3.8/dist-packages/werkzeug/utils.py", line 90, in __get__
value = self.func(obj)
File "/usr/local/lib/python3.8/dist-packages/werkzeug/routing.py", line 281, in suggested
return self.closest_rule(self.adapter)
File "/usr/local/lib/python3.8/dist-packages/werkzeug/routing.py", line 297, in closest_rule
return max(adapter.map._rules, key=_score_rule)
File "/usr/local/lib/python3.8/dist-packages/werkzeug/routing.py", line 288, in _score_rule
* difflib.SequenceMatcher(
File "/usr/lib/python3.8/difflib.py", line 213, in __init__
self.set_seqs(a, b)
File "/usr/lib/python3.8/difflib.py", line 225, in set_seqs
self.set_seq2(b)
File "/usr/lib/python3.8/difflib.py", line 279, in set_seq2
self.__chain_b()
File "/usr/lib/python3.8/difflib.py", line 311, in __chain_b
for i, elt in enumerate(b):
TypeError: 'EndPoint' object is not iterable

Error to render compiling AST
TypeError: 'EndPoint' object is not iterable
Template: web.login_layout
Path: /t/t/div
Node: <div class="oe_website_login_container" t-raw="0"/>

很奇怪,提示我们web.login_layout这个qweb视图有问题,于是我们便到数据库后台去看这个视图的问题:

我们发现web.login_layout有两个继承的视图,由于boa_theme_default这个模块的优先级高于原生website,因此,我们推断正是因为boa这个模块的级别升高导致website模块的内容不能背正常的加载。

至于这两个视图为什么会冲突,经过分析,是因为两个视图都继承了基础视图login_view, 都使用了replace将元素替换掉,因此不论如何调整这两个视图的顺序,均不能解决冲突。

因此,解决方案就只能根据视图内容的结构来进行调整,本例当中,是直接将boa的视图禁用掉了。

你的支持我的动力