admin管理员组文章数量:1122832
I’m trying to install a custom Odoo 17 module, but when I attempt to install it, I get the following error,This error occurs when trying to load the XML file for my module. The XML structure appears to be correct, with the root element containing the tag, and all other records (views, actions, menu items) nested inside it.
file_import.xml:
<odoo>
<data>
<!-- Form View for File Import -->
<record id="view_file_import_form" model="ir.ui.view">
<field name="name">file.import.form</field>
<field name="model">file.import</field>
<field name="arch" type="xml">
<form string="File Import">
<sheet>
<group>
<field name="name" />
<field name="file_data" filename="name" widget="binary" />
<field name="file_type" />
</group>
</sheet>
<footer>
<button string="Import" type="object" name="process_file" class="btn-primary" />
<button string="Cancel" special="cancel" class="btn-secondary" />
</footer>
</form>
</field>
</record>
<!-- Tree View for File Import -->
<record id="view_file_import_tree" model="ir.ui.view">
<field name="name">file.import.tree</field>
<field name="model">file.import</field>
<field name="arch" type="xml">
<tree string="Imported Files">
<field name="name" />
<field name="file_type" />
<field name="import_date" />
<field name="file_data" widget="binary" />
</tree>
</field>
</record>
<!-- Action for File Import Form -->
<record id="action_file_import" model="ir.actions.act_window">
<field name="name">File Import</field>
<field name="res_model">file.import</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_file_import_form" />
<field name="target">new</field>
</record>
<!-- Action for Viewing Imported Files -->
<record id="action_file_import_list" model="ir.actions.act_window">
<field name="name">Imported Files</field>
<field name="res_model">file.import</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_file_import_tree" />
<field name="target">current</field>
</record>
<!-- Menu Item for File Import -->
<menuitem id="menu_file_import" name="File Import" parent="base.menu_administration" action="action_file_import" sequence="10" />
<!-- Menu Item for Imported Files List -->
<menuitem id="menu_file_import_list" name="Imported Files" parent="base.menu_administration" action="action_file_import_list" sequence="20" icon="fa fa-file-upload" />
</data>
</odoo>
model.py
from odoo import models, fields, api
class FileImport(models.Model):
_name = "file.import"
_description = "File Import"
name = fields.Char(string="File Name", required=True)
file_type = fields.Selection(
[
("csv", "CSV"),
("json", "JSON"),
("xlsx", "Excel"),
("pdf", "PDF"),
],
string="File Type",
required=True,
)
import_date = fields.Datetime(string="Import Date", default=fields.Datetime.now)
file_data = fields.Binary(string="File Data", required=False)
本文标签: pythonAssertionError Element odoo has extra content dataline 2Stack Overflow
版权声明:本文标题:python - AssertionError: Element odoo has extra content: data, line 2 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282334a1926611.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论