urd_odoo_addons/smile_access_control/views/res_users_view.xml
2017-01-16 15:04:22 +01:00

134 lines
5.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="0">
<!-- Users -->
<!-- Add widget selection to choose a profile to apply -->
<record id="view_res_user_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="mode">primary</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<data>
<field name="active" position="after">
<field name="user_profile_id" widget="selection" attrs="{'required': True}"/>
</field>
</data>
</field>
</record>
<record id="base.action_res_users" model="ir.actions.act_window">
<field name="domain">[('user_profile', '=', False)]</field>
</record>
<record id="base.action_res_users_view2" model="ir.actions.act_window.view">
<field name="view_id" ref="view_res_user_form"/>
</record>
<!--Add information on profile of the users in tree view-->
<record id="view_users_tree" model="ir.ui.view">
<field name="name">esg.res.users.tree</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_tree"/>
<field name="priority">10</field>
<field name="arch" type="xml">
<data>
<field name="login" position="before">
<field name="user_profile_id"/>
</field>
</data>
</field>
</record>
<!-- Profiles -->
<!-- Add page for technical profile configuration-->
<record id="view_user_profile_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="mode">primary</field>
<field name="priority">10</field>
<field name="arch" type="xml">
<data>
<field name="active" position="before">
<field name="user_profile" invisible="True"/>
<field name="is_update_users" attrs="{'invisible': [('user_profile', '=', False)]}"/>
</field>
<field name="name" position="attributes">
<attribute name="placeholder">Profile ...</attribute>
</field>
<notebook position="inside">
<page string="Configuration">
<separator string="Linked users" colspan="4"/>
<field name="user_ids" nolabel="1" colspan="4" widget="many2many" context="{'form_view_ref': 'base.view_users_form'}"/>
<separator string="Fields to update for linked users" colspan="4"/>
<field name="field_ids" nolabel="1" colspan="4"/>
</page>
</notebook>
</data>
</field>
</record>
<record id="action_res_user_profiles" model="ir.actions.act_window">
<field name="name">User Profiles</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="base.view_users_tree"/>
<field name="search_view_id" ref="base.view_users_search"/>
<field name="domain">[('user_profile', '=', True)]</field>
<field name="domain" eval="[('id', '!=', ref('base.user_root')), ('user_profile', '=', True)]"/>
<field name="context">{'active_test': False, 'default_user_profile': True}</field>
<field name="help"></field>
</record>
<record id="action_res_user_profiles_tree_view" model="ir.actions.act_window.view">
<field eval="1" name="sequence"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="base.view_users_tree"/>
<field name="act_window_id" ref="action_res_user_profiles"/>
</record>
<record id="action_res_user_profiles_form_view" model="ir.actions.act_window.view">
<field eval="2" name="sequence"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_user_profile_form"/>
<field name="act_window_id" ref="action_res_user_profiles"/>
</record>
<menuitem action="action_res_user_profiles" id="menu_action_res_user_profiles" parent="base.menu_users" sequence="40"/>
<!-- Super Admin -->
<!-- Hide Create button for Super Admin menu -->
<record id="view_admin_form" model="ir.ui.view">
<field name="name">res.users.form</field>
<field name="model">res.users</field>
<field name="inherit_id" ref="base.view_users_form"/>
<field name="mode">primary</field>
<field name="arch" type="xml">
<data>
<form string="Users" position="attributes">
<attribute name="create">false</attribute>
</form>
</data>
</field>
</record>
<record id="action_server_superadmin" model="ir.actions.server">
<field name="name">Super Admin</field>
<field name="model_id" ref="base.model_res_users"/>
<field name="code">
action = {
"type": "ir.actions.act_window",
"view_mode": "form",
"view_id": env.ref('smile_access_control.view_admin_form').id,
"res_model": "res.users",
"res_id": env.ref('base.user_root').id,
}
</field>
</record>
<menuitem action="action_server_superadmin" id="menu_action_superadmin" parent="base.menu_users" sequence="50"/>
</data>
</openerp>