<?xml version="1.0" encoding="utf-8"?>
<openerp>
    <data>
        <!-- res.groups -->
        <record id="view_groups_search" model="ir.ui.view">
            <field name="name">res.groups.search</field>
            <field name="model">res.groups</field>
            <field name="arch" type="xml">
                <search string="Groups">
                    <field name="name" filter_domain="['|', ('name','ilike',self), ('category_id','ilike',self)]" string="Group"/>
                </search>
            </field>
        </record>
        <record id="view_groups_form" model="ir.ui.view">
            <field name="name">res.groups.form</field>
            <field name="model">res.groups</field>
            <field name="arch" type="xml">
                <form string="Groups" version="7.0">
                  <sheet>
                    <group col="4">
                        <field name="category_id"/>
                        <field name="name"/>
                    </group>
                    <notebook>
                        <page string="Users">
                            <field name="users"/>
                        </page>
                        <page string="Inherited">
                            <label string="Users added to this group are automatically added in the following groups."/>
                            <field name="implied_ids"/>
                        </page>
                        <page string="Menus">
                            <field name="menu_access"/>
                        </page>
                        <page string="Views">
                            <field name="view_access"/>
                        </page>
                        <page string="Access Rights">
                            <field name="model_access">
                                <tree string="Access Rules" editable="top">
                                    <field name="model_id"/>
                                    <field name="perm_read"/>
                                    <field name="perm_write"/>
                                    <field name="perm_create"/>
                                    <field name="perm_unlink"/>
                                    <field name="name"/>
                                </tree>
                                <form string="Access Controls" version="7.0">
                                    <group col="4">
                                        <field name="name"/>
                                        <field name="active"/>
                                        <field name="model_id"/>
                                        <newline/>
                                        <field name="perm_read"/>
                                        <field name="perm_write"/>
                                        <field name="perm_create"/>
                                        <field name="perm_unlink"/>
                                    </group>
                                </form>
                            </field>
                        </page>
                        <page string="Rules">
                            <field name="rule_groups">
                                <tree string="Rules">
                                    <field name="name"/>
                                    <field name="model_id"/>
                                    <field name="global"/>
                                </tree>
                            </field>
                        </page><page string="Notes">
                            <field name="comment"/>
                        </page>
                    </notebook>
                  </sheet>
                </form>
            </field>
        </record>
        <record id="action_res_groups" model="ir.actions.act_window">
            <field name="name">Groups</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.groups</field>
            <field name="view_type">form</field>
            <field name="help">A group is a set of functional areas that will be assigned to the user in order to give them access and rights to specific applications and tasks in the system. You can create custom groups or edit the ones existing by default in order to customize the view of the menu that users will be able to see. Whether they can have a read, write, create and delete access right can be managed from here.</field>
        </record>
        <menuitem action="action_res_groups" id="menu_action_res_groups" parent="base.menu_users" groups="base.group_no_one"/>


        <!-- res.users -->
        <record id="view_users_simple_form" model="ir.ui.view">
            <field name="name">res.users.simplified.form</field>
            <field name="model">res.users</field>
            <field name="priority">1</field>
            <field name="arch" type="xml">
                <form string="Contact" version="7.0">
                    <sheet>
                    <field name="image" widget='image' class="oe_left oe_avatar" options='{"preview_image": "image_medium", "size": [90, 90]}'/>
                    <div class="oe_title">
                        <div class="oe_edit_only">
                            <label for="name"/>
                        </div>
                        <h1>
                            <field name="name" default_focus="1" placeholder="Name" />
                        </h1>
                        <field name="category_id" widget="many2many_tags" placeholder="Tags..."/>
                    </div>
                    <group>
                        <group>
                            <label for="street" string="Address"/>
                            <div>
                                <field name="street" placeholder="Street..."/>
                                <field name="street2"/>
                                <div class="address_format">
                                    <field name="city" placeholder="City" style="width: 40%%"/>
                                    <field name="state_id" class="oe_no_button" placeholder="State" style="width: 37%%" options='{"no_open": True}' on_change="onchange_state(state_id)"/>
                                    <field name="zip" placeholder="ZIP" style="width: 20%%"/>
                                </div>
                                <field name="country_id" placeholder="Country" class="oe_no_button" options='{"no_open": True}'/>
                            </div>
                            <field name="website" widget="url" placeholder="e.g. www.openerp.com"/>
                        </group>
                        <group>
                            <field name="phone" placeholder="e.g. +32.81.81.37.00"/>
                            <field name="mobile"/>
                            <field name="fax"/>
                            <field name="email" widget="email"/>
                        </group>
                    </group>
                </sheet>
                </form>
            </field>
        </record>
        <record id="view_users_form" model="ir.ui.view">
            <field name="name">res.users.form</field>
            <field name="model">res.users</field>
            <field name="arch" type="xml">
                <form string="Users" version="7.0">
                    <field name="id" invisible="1"/>
                    <sheet>
                        <div class="oe_right oe_button_box">
                            <button string="Change Password" type="action" name="%(change_password_wizard_action)d"
                                help="Change the user password."/>
                        </div>
                        <field name="image" widget='image' class="oe_avatar oe_left" options='{"preview_image": "image_medium"}'/>
                        <div class="oe_title">
                            <label for="name" class="oe_edit_only"/>
                            <h1><field name="name"/></h1>
                            <label for="login" class="oe_edit_only"/>
                            <h2><field name="login"/></h2>
                        </div>
                        <group>
                            <group>
                                <field name="company_id" context="{'user_preference': 0}"/>
                            </group>
                            <group>
                                <field name="active"/>
                            </group>
                        </group>

                        <notebook colspan="4">
                            <page string="Preferences">
                                <group>
                                    <group name="preferences">
                                        <field name="lang"/>
                                        <field name="tz"/>
                                    </group>
                                    <group groups="base.group_no_one">
                                        <field name="action_id"/>
                                        <field domain="[('usage','=','menu')]" name="menu_id" required="True"/>
                                    </group>
                                </group>
                                <group>
                                    <field name="email" widget="email"/>
                                    <field name="signature"/>
                                </group>
                            </page>
                            <page string="Access Rights">
                                <group string="Allowed Companies" groups="base.group_multi_company">
                                    <field name="company_ids" nolabel="1" widget="many2many_tags"/>
                                </group>
                                <group col="4">
                                    <field name="groups_id"/>
                                </group>
                            </page>
                        </notebook>
                    </sheet>
                </form>
            </field>
        </record>
        <record id="view_users_tree" model="ir.ui.view">
            <field name="name">res.users.tree</field>
            <field name="model">res.users</field>
            <field name="arch" type="xml">
                <tree string="Users">
                    <field name="name"/>
                    <field name="login"/>
                    <field name="lang"/>
                    <field name="login_date"/>
                </tree>
            </field>
        </record>
        <record id="view_users_search" model="ir.ui.view">
            <field name="name">res.users.search</field>
            <field name="model">res.users</field>
            <field name="arch" type="xml">
                <search string="Users">
                    <field name="name" filter_domain="['|', ('name','ilike',self), ('login','ilike',self)]" string="User"/>
                    <field name="company_ids" string="Company" groups="base.group_multi_company"/>
                </search>
            </field>
        </record>
        <record id="user_groups_view" model="ir.ui.view">
            <field name="name">res.users.groups</field>
            <field name="model">res.users</field>
            <field name="inherit_id" ref="view_users_form"/>
            <field name="arch" type="xml">
                <!-- dummy, will be modified by groups -->
                <field name="groups_id" position="after"/>
            </field>
        </record>
        <record id="action_res_users" model="ir.actions.act_window">
            <field name="name">Users</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.users</field>
            <field name="view_type">form</field>
            <field name="view_id" ref="view_users_tree"/>
            <field name="search_view_id" ref="view_users_search"/>
            <field name="help">Create and manage users that will connect to the system. Users can be deactivated should there be a period of time during which they will/should not connect to the system. You can assign them groups in order to give them specific access to the applications they need to use in the system.</field>
        </record>
        <record id="action_res_users_view1" model="ir.actions.act_window.view">
            <field eval="10" name="sequence"/>
            <field name="view_mode">tree</field>
            <field name="view_id" ref="view_users_tree"/>
            <field name="act_window_id" ref="action_res_users"/>
        </record>
        <record id="action_res_users_view2" model="ir.actions.act_window.view">
            <field eval="20" name="sequence"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_users_form"/>
            <field name="act_window_id" ref="action_res_users"/>
        </record>
        <menuitem action="action_res_users" id="menu_action_res_users" parent="base.menu_users"/>

        <record id="view_users_form_simple_modif" model="ir.ui.view">
            <field name="name">res.users.preferences.form</field>
            <field name="model">res.users</field>
            <field eval="18" name="priority"/>
            <field name="arch" type="xml">
                <form string="Users" version="7.0">
                    <field name="image" readonly="0" widget='image' class="oe_right oe_avatar" options='{"preview_image": "image_small"}'/>
                    <h1>
                        <field name="name" readonly="1" class="oe_inline"/>
                        (<field name="login" readonly="1" class="oe_inline"/>)
                    </h1>
                    <button name="preference_change_password" type="object" string="Change password" class="oe_link"/>
                    <group name="preferences" col="4">
                        <field name="lang" readonly="0"/>
                        <field name="tz" readonly="0"/>
                        <field name="company_id" widget="selection" readonly="0"
                            groups="base.group_multi_company" on_change="on_change_company_id(company_id)"/>
                    </group>
                    <group string="Email Preferences">
                        <field name="email" widget="email" readonly="0"/>
                        <field name="signature" readonly="0"/>
                    </group>
                    <footer>
                        <button name="preference_save" type="object" string="Save"/>
                        or
                        <button name="preference_cancel" string="Cancel" special="cancel" class="oe_link"/>
                    </footer>
                </form>
            </field>
        </record>
        <record id="action_res_users_my" model="ir.actions.act_window">
            <field name="name">Change My Preferences</field>
            <field name="type">ir.actions.act_window</field>
            <field name="res_model">res.users</field>
            <field name="target">new</field>
            <field name="view_type">form</field>
            <field name="view_mode">form</field>
        </record>
        <record id="action_res_users_my_view2" model="ir.actions.act_window.view">
            <field eval="10" name="sequence"/>
            <field name="view_mode">form</field>
            <field name="view_id" ref="view_users_form_simple_modif"/>
            <field name="act_window_id" ref="action_res_users_my"/>
        </record>

    </data>
</openerp>
