尝试在 odoo 14 中列出用户时出错
Posted
技术标签:
【中文标题】尝试在 odoo 14 中列出用户时出错【英文标题】:Error when trying to list users in odoo 14 【发布时间】:2021-04-13 15:00:41 【问题描述】:当我进入用户设置时,我收到以下错误:
模型上的无效字段“documents_account_settings” 'res.config.settings'
我一直在查看基本代码,似乎字段 documents_account_settings 不再在模型中, 我一直在查看的文件是这个 /home/odoo/src/odoo/addons/account/models/res_config_settings.py
是否有任何与此相关的已知错误?
这是完整的跟踪如下:
Odoo Server Error
Traceback (most recent call last):
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/home/odoo/src/odoo/odoo/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/home/odoo/src/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/home/odoo/src/odoo/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 912, in __call__
return self.method(*args, **kw)
File "/home/odoo/src/odoo/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1377, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/home/odoo/src/odoo/addons/web/controllers/main.py", line 1369, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 394, in call_kw
result = _call_kw_model_create(method, model, args, kwargs)
File "/home/odoo/src/odoo/odoo/api.py", line 374, in _call_kw_model_create
result = method(recs, *args, **kwargs)
File "<decorator-gen-188>", line 2, in create
File "/home/odoo/src/odoo/odoo/api.py", line 323, in _model_create_single
return create(self, arg)
File "/home/odoo/src/odoo/addons/account/models/res_config_settings.py", line 176, in create
return super(ResConfigSettings, self).create(values)
File "<decorator-gen-64>", line 2, in create
File "/home/odoo/src/odoo/odoo/api.py", line 344, in _model_create_multi
return create(self, [arg])
File "/home/odoo/src/odoo/odoo/addons/base/models/ir_fields.py", line 533, in create
recs = super().create(vals_list)
File "<decorator-gen-13>", line 2, in create
File "/home/odoo/src/odoo/odoo/api.py", line 345, in _model_create_multi
return create(self, arg)
File "/home/odoo/src/odoo/odoo/models.py", line 3818, in create
raise ValueError("Invalid field %r on model %r" % (key, self._name))
Exception
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 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/odoo/src/odoo/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: Invalid field 'documents_account_settings' on model 'res.config.settings'
【问题讨论】:
【参考方案1】:确保您已安装应用程序documents_account
,它将被初始化。
【讨论】:
【参考方案2】:通常,当我们(开发人员)需要管理员输入的内容时,我们会在res.config.settings
中创建一个字段来获取它,因此如果您在模块account
中查找它,您可能永远看不到它,它已创建由另一个模块。此错误是由于未安装正确的模块引起的,或者更具体而言,您正在打开一个显示该字段 (documents_account_settings
) 的视图,但您的数据库中没有该字段。
在这种情况下,您可以做两件事(我知道)以使其变得更好:
在您的源代码中查找此字段的创建位置,并更新或安装该模块,或者更简单(对于 Odoo 用户)更新模块base
,它可能会重置您数据库中的问题模块。
如果您是开发人员(如果为 true,我更喜欢),您可以转到您的数据库表 ir_ui_view
,查找导致该问题的视图(继承名为“res.config.settings.view.form”的视图)然后改变它的架构部分。
希望您觉得这对您有所帮助,因为我只能向您展示归档目标的方法,不能为您完成。
【讨论】:
以上是关于尝试在 odoo 14 中列出用户时出错的主要内容,如果未能解决你的问题,请参考以下文章
在 Odoo 14 中使用 purchase.order.line 中的搜索功能时出错