Search code examples
pythonxmlstringodooseparator

Hide "Separator" in XML View - OpenErp


I need to hide a "Separator" and all it's child items (trees, fields, buttons, etc), i'm stuck and don't know how to achieve this

<separator string="Quotations" />
                    <field name="purchase_ids" readonly="1">
                        <tree string="Purchase Order">
                            <field name="name" string="Reference"/>
                            <field name="date_order" string="Order Date"/>
                            <field name="partner_id"/>
                            <field name="company_id" groups="base.group_multi_company" widget="selection"/>
                            <field name="location_id" groups="stock.group_locations"/>
                            <field name="minimum_planned_date"/>
                            <field name="origin"/>
                            <field name="state"/>
                            <button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order" icon="gtk-cancel"/>
                            <button name="purchase_confirm" states="draft" string="Confirm Purchase Order" icon="gtk-apply"/>
                            <button name="purchase_approve" states="confirmed" string="Approved by Supplier" icon="gtk-ok"/>
                        </tree>
                    </field>

If anybody could help, would be very appreciated, thank you very much in advance!


Solution

  • If you need to hide fields for particular roles/groups, you can use groups attribute like this:

    <field name="name" groups="GROUP_XML_ID"/>
    

    It means that if your current user has no this group, He won't be able to see those fields.

    If you need to hide fields for particular conditions, you can use attrs attribute like this:

    <separator string="Description" colspan="4" attrs="{'invisible': [('show_config', '=', False)]}" />
    

    Otherwise, invisible="1" would be nice to use.

    Thanks.