<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <record model="ir.ui.view" id="res_users_search_sharing">
            <field name="name">res.users.search.share</field>
            <field name="model">res.users</field>
            <field name="inherit_id" ref="base.view_users_search"/>
            <field name="arch" type="xml">
                <xpath expr="//field[@name='company_ids']" position="after">
                    <filter name="no_share" string="Regular users only (no share user)" icon="terp-partner"
                        domain="[('share','=',False)]"/>
                </xpath>
                <xpath expr="//field[@name='company_ids']" position="after">
                    <field name="share"/>
                </xpath>
            </field>
        </record>

        <!-- Hide share users/groups by default -->
        <record model="ir.actions.act_window" id="base.action_res_users">
            <field name="name">Users</field>
            <field name="context">{'search_default_no_share': 1}</field>
        </record>

        <record model="ir.ui.view" id="res_groups_search_sharing">
            <field name="name">res.groups.search.share</field>
            <field name="model">res.groups</field>
            <field name="inherit_id" ref="base.view_groups_search"/>
            <field name="arch" type="xml">
                <field name="name" position="after">
                    <filter name="share" string="Share Groups" domain="[('share','=',True)]"/>
                    <filter name="no_share" string="Non-Share Groups" domain="[('share','=',False)]"/>
                    <separator orientation="vertical"/>
                </field>
            </field>
        </record>

        <!-- Hide share users/groups by default -->
        <record model="ir.actions.act_window" id="base.action_res_groups">
            <field name="name">Groups</field>
            <field name="context">{'search_default_no_share': 1}</field>
        </record>
        <record id="view_groups_form_share" model="ir.ui.view">
            <field name="name">res.groups.form</field>
            <field name="model">res.groups</field>
            <field name="inherit_id" ref="base.view_groups_form"/>
            <field name="arch" type="xml">
                <field name="users" position="attributes">
                    <attribute name="context">{'search_default_no_share':1}</attribute>
                </field>
                <field name="name" position="after">
                    <field name="share"/>
                </field>
            </field>
        </record>
    </data>
</openerp>
