AssertionError: Element odoo has extra content: record, line 3 - - - Odoo13
AssertionError: Element odoo has extra content: record, line 3 - - - Odoo13
我正在尝试在 Actions
下添加菜单。但是我遇到了以下错误。
2019-12-24 11:28:28,309 22740 ERROR odoo13 werkzeug: Error on request:
Traceback (most recent call last): File
"/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line
270, in run_wsgi
execute(self.server.app) File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line
258, in execute
application_iter = app(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/service/server.py", line 414,
in app
return self.app(e, s) File "/home/user/Projects/odoo_13.0.EE/odoo/service/wsgi_server.py", line
142, in application
return application_unproxied(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/service/wsgi_server.py", line
117, in application_unproxied
result = odoo.http.root(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1281, in
call
return self.dispatch(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1251, in
call
return self.app(environ, start_wrapped) File "/usr/local/lib/python3.6/dist-packages/werkzeug/wsgi.py", line 766,
in call
return self.app(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1433, in
dispatch
odoo.registry(db).check_signaling() File "/home/user/Projects/odoo_13.0.EE/odoo/init.py", line 104, in
registry
return modules.registry.Registry(database_name) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/registry.py", line 61,
in new
return cls.new(db_name) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/registry.py", line 85,
in new
odoo.modules.load_modules(registry._db, force_demo, status, update_module) File
"/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 416,
in load_modules
force, status, report, loaded_modules, update_module, models_to_check) File
"/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 312,
in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line
222, in load_module_graph
load_data(cr, idref, mode, kind='data', package=package, report=report) File
"/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 68,
in load_data
tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report) File
"/home/user/Projects/odoo_13.0.EE/odoo/tools/convert.py", line 737, in
convert_file
convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/home/user/Projects/odoo_13.0.EE/odoo/tools/convert.py", line
787, in convert_xml_import
relaxng.assert_(doc) File "src/lxml/etree.pyx", line 3536, in lxml.etree.Validator.assert
AssertionError: Element odoo has extra
content: record, line 3 - - -
*.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="import_image_view_form" model="ir.ui.view">
<field name="name">import.image.form</field>
<field name="model">import.image</field>
<field name="arch" type="xml">
<form string="Import Images">
<group >
<field widget="binary" height="64" name="file" filename="file_fname" required="1"/>
<field name="file_fname" invisible="1"/>
</group>
<footer>
<button name="get_file" type="object" class="oe_highlight" string="Load File" style="width:75px;"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="import_image_action_form" model="ir.actions.act_window">
<field name="name">Import product images</field>
<field name="res_model">import.image</field>
<field name="view_mode">form</field>
<field name="view_id" ref="import_image_view_form"/>
<field name="target">new</field>
</record>
<act_window
name="Import Product Image"
id="action_import_product_image"
res_model="import.image"
src_model="product.template"
target="new" multi="True" key2="client_action_multi"/>
</odoo>
您没有在 xml
代码中提到 <data>
。我已经更新了它。请尝试以下代码。
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="import_image_view_form" model="ir.ui.view">
<field name="name">import.image.form</field>
<field name="model">import.image</field>
<field name="arch" type="xml">
<form string="Import Images">
<group >
<field widget="binary" height="64" name="file" filename="file_fname" required="1"/>
<field name="file_fname" invisible="1"/>
</group>
<footer>
<button name="get_file" type="object" class="oe_highlight" string="Load File" style="width:75px;"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="import_image_action_form" model="ir.actions.act_window">
<field name="name">Import product images</field>
<field name="res_model">import.image</field>
<field name="view_mode">form</field>
<field name="view_id" ref="import_image_view_form"/>
<field name="target">new</field>
</record>
<act_window
name="Import Product Image"
res_model="import.image"
src_model="product.template"
view_mode="form"
target="new"
multi="True"
key2="client_action_multi"
id="action_import_product_image" />
</data>
</odoo>
终于,我找到了解决办法。我刚刚删除了 act_window
标签。并在 ir.actions.act_window
.
中添加了字段 binding_model_id
<record id="import_image_action_form" model="ir.actions.act_window">
<field name="name">Import product images</field>
<field name="res_model">import.image</field>
<field name="view_mode">form</field>
<field name="view_id" ref="import_image_view_form"/>
<field name="target">new</field>
<field name="binding_model_id" ref="account.model_product_template" />
</record>
有效。
我正在尝试在 Actions
下添加菜单。但是我遇到了以下错误。
2019-12-24 11:28:28,309 22740 ERROR odoo13 werkzeug: Error on request: Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 270, in run_wsgi execute(self.server.app) File "/usr/local/lib/python3.6/dist-packages/werkzeug/serving.py", line 258, in execute application_iter = app(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/service/server.py", line 414, in app return self.app(e, s) File "/home/user/Projects/odoo_13.0.EE/odoo/service/wsgi_server.py", line 142, in application return application_unproxied(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/service/wsgi_server.py", line 117, in application_unproxied result = odoo.http.root(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1281, in call return self.dispatch(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1251, in call return self.app(environ, start_wrapped) File "/usr/local/lib/python3.6/dist-packages/werkzeug/wsgi.py", line 766, in call return self.app(environ, start_response) File "/home/user/Projects/odoo_13.0.EE/odoo/http.py", line 1433, in dispatch odoo.registry(db).check_signaling() File "/home/user/Projects/odoo_13.0.EE/odoo/init.py", line 104, in registry return modules.registry.Registry(database_name) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/registry.py", line 61, in new return cls.new(db_name) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/registry.py", line 85, in new odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 416, in load_modules force, status, report, loaded_modules, update_module, models_to_check) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 312, in load_marked_modules perform_checks=perform_checks, models_to_check=models_to_check File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 222, in load_module_graph load_data(cr, idref, mode, kind='data', package=package, report=report) File "/home/user/Projects/odoo_13.0.EE/odoo/modules/loading.py", line 68, in load_data tools.convert_file(cr, package.name, filename, idref, mode, noupdate, kind, report) File "/home/user/Projects/odoo_13.0.EE/odoo/tools/convert.py", line 737, in convert_file convert_xml_import(cr, module, fp, idref, mode, noupdate, report) File "/home/user/Projects/odoo_13.0.EE/odoo/tools/convert.py", line 787, in convert_xml_import relaxng.assert_(doc) File "src/lxml/etree.pyx", line 3536, in lxml.etree.Validator.assert
AssertionError: Element odoo has extra content: record, line 3 - - -
*.xml
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="import_image_view_form" model="ir.ui.view">
<field name="name">import.image.form</field>
<field name="model">import.image</field>
<field name="arch" type="xml">
<form string="Import Images">
<group >
<field widget="binary" height="64" name="file" filename="file_fname" required="1"/>
<field name="file_fname" invisible="1"/>
</group>
<footer>
<button name="get_file" type="object" class="oe_highlight" string="Load File" style="width:75px;"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="import_image_action_form" model="ir.actions.act_window">
<field name="name">Import product images</field>
<field name="res_model">import.image</field>
<field name="view_mode">form</field>
<field name="view_id" ref="import_image_view_form"/>
<field name="target">new</field>
</record>
<act_window
name="Import Product Image"
id="action_import_product_image"
res_model="import.image"
src_model="product.template"
target="new" multi="True" key2="client_action_multi"/>
</odoo>
您没有在 xml
代码中提到 <data>
。我已经更新了它。请尝试以下代码。
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="import_image_view_form" model="ir.ui.view">
<field name="name">import.image.form</field>
<field name="model">import.image</field>
<field name="arch" type="xml">
<form string="Import Images">
<group >
<field widget="binary" height="64" name="file" filename="file_fname" required="1"/>
<field name="file_fname" invisible="1"/>
</group>
<footer>
<button name="get_file" type="object" class="oe_highlight" string="Load File" style="width:75px;"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
<record id="import_image_action_form" model="ir.actions.act_window">
<field name="name">Import product images</field>
<field name="res_model">import.image</field>
<field name="view_mode">form</field>
<field name="view_id" ref="import_image_view_form"/>
<field name="target">new</field>
</record>
<act_window
name="Import Product Image"
res_model="import.image"
src_model="product.template"
view_mode="form"
target="new"
multi="True"
key2="client_action_multi"
id="action_import_product_image" />
</data>
</odoo>
终于,我找到了解决办法。我刚刚删除了 act_window
标签。并在 ir.actions.act_window
.
binding_model_id
<record id="import_image_action_form" model="ir.actions.act_window">
<field name="name">Import product images</field>
<field name="res_model">import.image</field>
<field name="view_mode">form</field>
<field name="view_id" ref="import_image_view_form"/>
<field name="target">new</field>
<field name="binding_model_id" ref="account.model_product_template" />
</record>
有效。