首页 > 解决方案 > odoo:不可能在 one2many 上使一条线不可见吗?

问题描述

我正在尝试根据字段filtre_project(在 stock.picking 中)使一些行(one2many stock.move)不可见。
我尝试使用域作为:

<field name="move_lines" position="attributes">
    <attribute name="domain">[('project_id','in',filtre_project and filtre_project[0] and filtre_project[0][2])]
</attribute>

标签: odooinvisibleone2many

解决方案


您不能在树/列表视图中有条件地隐藏字段,您可以不可见,但这应该针对所有数据而不是有条件地修复。

我不确定,但你可以通过使用不可见的上下文来实现这一点。

例子 :

<field name="department_id" invisible="context.get('invisible_department', True)"/>

推荐阅读