自建模块过程中报odoo.exceptions.ValidationError: 验证视图时出错:
-
学习odoo14,自建模块报以下错误,具体怎么解决,请各位大师指教
错误:
Odoo Server ErrorTraceback (most recent call last):
File "D:\odoo\server\odoo\tools\convert.py", line 677, in _tag_root
f(rec)
File "D:\odoo\server\odoo\tools\convert.py", line 580, in _tag_record
record = model._load_records([data], self.mode == 'update')
File "D:\odoo\server\odoo\models.py", line 4231, in _load_records
records = self._load_records_create([data['values'] for data in to_create])
File "D:\odoo\server\odoo\models.py", line 4152, in _load_records_create
return self.create(values)
File "", line 2, in create
File "D:\odoo\server\odoo\api.py", line 348, in _model_create_multi
return create(self, arg)
File "D:\odoo\server\odoo\addons\base\models\ir_ui_view.py", line 482, in create
return super(View, self).create(vals_list)
File "", line 2, in create
File "D:\odoo\server\odoo\api.py", line 348, in _model_create_multi
return create(self, arg)
File "D:\odoo\server\odoo\addons\base\models\ir_fields.py", line 534, in create
recs = super().create(vals_list)
File "", line 2, in create
File "D:\odoo\server\odoo\api.py", line 348, in _model_create_multi
return create(self, arg)
File "D:\odoo\server\odoo\models.py", line 3909, in create
fields[0].determine_inverse(batch_recs)
File "D:\odoo\server\odoo\fields.py", line 1187, in determine_inverse
getattr(records, self.inverse)()
File "D:\odoo\server\odoo\addons\base\models\ir_ui_view.py", line 300, in _inverse_arch
view.write(data)
File "D:\odoo\server\odoo\addons\base\models\ir_ui_view.py", line 500, in write
res = super(View, self).write(self._compute_defaults(vals))
File "D:\odoo\server\odoo\models.py", line 3693, in write
real_recs._validate_fields(vals, inverse_fields)
File "D:\odoo\server\odoo\models.py", line 1266, in _validate_fields
check(self)
File "D:\odoo\server\odoo\addons\base\models\ir_ui_view.py", line 411, in _check_xml
)).with_traceback(e.traceback) from None
File "D:\odoo\server\odoo\addons\base\models\ir_ui_view.py", line 391, in _check_xml
view.postprocess_and_fields(view_doc, validate=True)
File "D:\odoo\server\odoo\addons\base\models\ir_ui_view.py", line 850, in postprocess_and_fields
arch, name_manager = self._postprocess_view(node, model, validate=validate)
File "D:\odoo\server\odoo\addons\base\models\ir_ui_view.py", line 857, in postprocess_view
self.handle_view_error(('Model not found: %(model)s', model=model))
File "D:\odoo\server\odoo\addons\base\models\ir_ui_view.py", line 673, in handle_view_error
raise ValueError(formatted_message).with_traceback(from_traceback) from from_exception
odoo.exceptions.ValidationError: 验证视图时出错:没有找到模型: library.book
View name: 馆藏图书窗体
Error context:
view: ir.ui.view(285,)
xmlid: used_car_view_form
view.model: library.book
file: d:\odoo\server\my_addons\usedcar\views\used_car_views.xmlThe above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\odoo\server\odoo\addons\base\models\ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "D:\odoo\server\odoo\http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "D:\odoo\server\odoo\http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "D:\odoo\server\odoo\service\model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "D:\odoo\server\odoo\http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "D:\odoo\server\odoo\http.py", line 912, in call
return self.method(*args, **kw)
File "D:\odoo\server\odoo\http.py", line 531, in response_wrap
response = f(*args, **kw)
File "D:\odoo\server\odoo\addons\web\controllers\main.py", line 1394, in call_button
action = self._call_kw(model, method, args, kwargs)
File "D:\odoo\server\odoo\addons\web\controllers\main.py", line 1382, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "D:\odoo\server\odoo\api.py", line 399, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "D:\odoo\server\odoo\api.py", line 386, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "", line 2, in button_immediate_install
File "D:\odoo\server\odoo\addons\base\models\ir_module.py", line 74, in check_and_log
return method(self, *args, **kwargs)
File "D:\odoo\server\odoo\addons\base\models\ir_module.py", line 475, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File "D:\odoo\server\odoo\addons\base\models\ir_module.py", line 593, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File "D:\odoo\server\odoo\modules\registry.py", line 89, in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module)
File "D:\odoo\server\odoo\modules\loading.py", line 461, in load_modules
loaded_modules, update_module, models_to_check)
File "D:\odoo\server\odoo\modules\loading.py", line 349, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File "D:\odoo\server\odoo\modules\loading.py", line 222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package)
File "D:\odoo\server\odoo\modules\loading.py", line 69, in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind)
File "D:\odoo\server\odoo\tools\convert.py", line 733, in convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate)
File "D:\odoo\server\odoo\tools\convert.py", line 799, in convert_xml_import
obj.parse(doc.getroot())
File "D:\odoo\server\odoo\tools\convert.py", line 719, in parse
self._tag_root(de)
File "D:\odoo\server\odoo\tools\convert.py", line 685, in _tag_root
)) from e
ExceptionThe above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "D:\odoo\server\odoo\http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "D:\odoo\server\odoo\http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing file:/d:/odoo/server/my_addons/usedcar/views/used_car_views.xml:4, near
馆藏图书窗体
library.book
-
@billchen0769 你是不是在XML中的tree添加了style属性
-
没有找到模型: library.book
View name: 馆藏图书窗体
Error context:
view: ir.ui.view(285,)
xmlid: used_car_view_form
view.model: library.book
file: d:\odoo\server\my_addons\ usedcar \views\ used_car_views.xml为什么初学还要用这么混乱的命名体系搞乱自己。在二手车(usedcar)的文件里定义馆藏书(library.book)。
然后把你的问题发在我们这 #服装制衣板块下?
系统告诉你没有找到
library.book
模型。看看你修改了代码后有没有重启服务器并升级你的usedcar
模块