0

我正在尝试为 Odoo 13 中的发票创建一个新的树视图,我的代码如下所示:

<odoo>

    <record model="ir.ui.view" id="new_invoice_tree">
        <field name="name">New Tree</field>
        <field name="model">account.move</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree>
                <field name="custom_field_1"/>
                <field name="custom_field_2"/>
            </tree>
        </field>
    </record>

    <record id="my_module.new_tree_action_window" model="ir.actions.act_window">
        <field name="name">New tree</field>
        <field name="res_model">account.move</field>
        <field name="view_mode">tree</field>
        <field name="view_id" ref="new_invoice_tree"/>
        <field name="type">ir.actions.act_window</field>
        <field name="domain">[('type','=','out_invoice')]</field>
    </record>

    <menuitem name="Libro de ventas"
              id="my_module.new_tree_menu"
              parent="my_parent_menu"
              action="my_module.new_tree_action_window"
              sequence="1"/>

</odoo>

但是当我尝试打开菜单时出现这个错误:

Rastreo de error:
Error: Unknown field state in domain
    at Class.compute (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:322:55)
    at evalModifier (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:1197:91)
    at Class._evalModifiers (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:1200:44)
    at Class._registerModifiers (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:1401:101)
    at Class._renderBodyCell (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:2076:70)
    at http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:2100:117
    at Array.map (<anonymous>)
    at Class._renderRow [as _super] (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:2100:80)
    at Class._renderRow (http://192.168.1.7:8070/web/content/317-6c3bb5c/web.assets_backend.js:2010:69)
    at Class._renderRow (http://192.168.1.7:8070/web/content/312-75a923f/web.assets_common.js:3863:371)

我不确定我的域应该是什么样子,我做错了什么?

4

1 回答 1

0

避免这种错误的方法是添加属性不可见的“状态”字段为True,如下所示:

<odoo>

    <record model="ir.ui.view" id="new_invoice_tree">
        <field name="name">New Tree</field>
        <field name="model">account.move</field>
        <field name="type">tree</field>
        <field name="arch" type="xml">
            <tree>
                <field name="state" invisible="True"/>
                <field name="custom_field_1"/>
                <field name="custom_field_2"/>
            </tree>
        </field>
    </record>

此错误出现在使用企业版 Odoo 的数据库上。

于 2020-02-27T23:43:36.103 回答