Hide lines on tree view - openerp 7

a 夏天 提交于 2019-12-12 07:05:45

问题


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?

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

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


回答1:


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

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.

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>


来源:https://stackoverflow.com/questions/37662048/hide-lines-on-tree-view-openerp-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!