隐藏树视图上的线-openerp 7 [英] Hide lines on tree view - openerp 7

查看:82
本文介绍了隐藏树视图上的线-openerp 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在序列树视图(默认视图)中隐藏所有行(不仅是cointaner). 如果代码!='foo',我必须隐藏所有行,但是attrs属性在树状视图上不起作用,那么如何过滤/隐藏它?

I want to hide all lines (not only there cointaner) in sequence tree view (the default view). I must hide all lines if code != 'foo' but the attrs atribute don't work on tree views, so how can i filter/hide this?

我还没有任何代码,因为我是openerp的新手,而且我不知道要更改什么.

I don't have any code already, because i'm newbie in openerp and i dont know what to change.

模型是ir.sequence,是视图(我认为).

The model is ir.sequence and is view (i think).

推荐答案

Attrs用于有条件地隐藏列/字段,但不用于 记录,必须使用隐藏记录域.

Attrs is to be used to hide columns / fields conditionally but not the record, to hide records domain must be used.

如果有默认的树状视图,并且您想从那里隐藏记录,那么您必须将域与操作一起传递.并假设有一个"one2many"字段,要在其中隐藏记录,则必须直接将域设置为该字段.

If there is default tree view and you want to hide records from there then you must pass domain with action. And suppose there is one2many field and into that you want to hide records then you must set domain directly to that field.

您可以按以下方式对两个域使用domain.

You can use domain in following manner for one2many fields.

<field name="one2many_field_name" domain="[('relational_model_field','operator','value')]">
    <tree>
        <field name="field1" />
        <field name="field2" />
        <field name="field3" />
    </tree>
</field>

要为默认树视图设置域,请对操作使用域.

And to set domain for default tree view, use domain with action.

<record id="action_id" model="ir.actions.act_window">
    <field name="name">Action Name</field>
    <field name="res_model">model</field>
    <field name="view_type">form</field>
    <field name="domain">[('field','operator','value')]</field>
    <field name="view_mode">tree,form</field>
</record>

这篇关于隐藏树视图上的线-openerp 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆