首页 > 解决方案 > 在 odoo 中添加自定义列表视图的问题

问题描述

当我在我的 .xml 文件中添加我的列表视图代码时,此代码:

<odoo>
    <data>
        <record id="test_list_view" model="ir.ui.view">
            <field name="arch" type="xml">
                <tree string="Tests">
                    <field name="name"/>
                    <field name="last_seen"/>
                </tree>
            </field>
        </record>
    </data>
</odoo>

到这个文件:(estate_list_views.xml)

由于这个错误,我无法完善我的模块

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/hadi/Public/st/odoo/odoo/http.py", line 640, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/hadi/Public/st/odoo/odoo/http.py", line 316, in _handle_exception
    raise exception.with_traceback(None) from new_cause
odoo.tools.convert.ParseError: while parsing /home/hadi/Public/st/odoo/oca/estate/views/estate_list_views.xml:3, near
<record id="test_list_view" model="ir.ui.view">
            <field name="arch" type="xml">
                <tree string="Tests">
                    <field name="name"/>
                    <field name="last_seen"/>
                </tree>
            </field>
        </record>

我遵循教程,但没有任何描述,除非向我介绍 odoo 的免费视频教程

标签: python-3.xxmlodoo-14

解决方案


我想你错过了型号名称试试这个:

<record id="test_list_view" model="ir.ui.view">
    <field name="name">model.tree.view</field>
    <field name="model">your.model.name</field>
    <field name= "arch" type = "xml">
        <tree string="Tests">
            <field name="name"/>
            <field name="last_seen"/>
        </tree>
    </field>
</record>

请参阅此内容以供参考。


推荐阅读