在odoo treeview中隐藏行

Hide lines in odoo treeview

我想隐藏不在库存中的设备。我试过

<record id="view_inventory_equipment_tree" model="ir.ui.view">
    <field name="name">maintenance.equipment.tree</field>
    <field name="model">maintenance.equipment</field>
    <field name="domain">[('inventory_id','=',False)]</field>

    <field name="arch" type="xml">
        <tree string="Lot/Serial Number Inventory">
            <field name="name"/>
            <field name="serial_no"/>
            <field name="category_id"/>
            <field name="inventory_id"/>
            <field name="cost"/>
        </tree>
    </field>
</record>

但这没有用,也没有运气

<field name="domain_force">[('inventory_id','=',False)]</field>

我的模特:

class MaintenanceEquipment(models.Model):
    _name = 'maintenance.equipment'
    _description = 'Equipment'

    name = fields.Char('Equipment Name', required=True, translate=True)

    inventory_id = fields.Many2one('maintenance.equipment.inventory', string='Equipment Inventory', track_visibility='onchange')

将域名付诸行动window记录。域不能直接与树视图或表单视图等任何视图一起使用。