New menu "Planning > Configuration > Employee Roles" opens an editable list of all active employees with two columns made for fast bulk assignment: - Default Role (m2o, fills new shifts automatically) - All Allowed Roles (m2m tags, controls open-shift visibility) Per-row inline editing with multi_edit enabled, grouped by department. No wizard, no popup — set role per employee in one screen and move on. Visible to planning.group_planning_manager. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
60 lines
2.6 KiB
XML
60 lines
2.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<odoo>
|
|
|
|
<!-- Editable list view for fast bulk-assignment of planning roles per employee. -->
|
|
<record id="hr_employee_view_list_planning_role_editor" model="ir.ui.view">
|
|
<field name="name">hr.employee.list.planning.role.editor</field>
|
|
<field name="model">hr.employee</field>
|
|
<field name="arch" type="xml">
|
|
<list string="Employee Roles"
|
|
editable="bottom"
|
|
multi_edit="1"
|
|
default_order="department_id, name">
|
|
<field name="name" readonly="1"/>
|
|
<field name="job_title" readonly="1" optional="show"/>
|
|
<field name="department_id" readonly="1" optional="show"/>
|
|
<field name="default_planning_role_id"
|
|
string="Default Role"
|
|
options="{'no_quick_create': True}"
|
|
widget="many2one"/>
|
|
<field name="planning_role_ids"
|
|
string="All Allowed Roles"
|
|
widget="many2many_tags"
|
|
options="{'no_quick_create': True, 'color_field': 'color'}"
|
|
optional="show"/>
|
|
<field name="active" column_invisible="1"/>
|
|
</list>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Action: open hr.employee filtered to active, in our editable list view -->
|
|
<record id="hr_employee_action_planning_role_editor" model="ir.actions.act_window">
|
|
<field name="name">Employee Roles</field>
|
|
<field name="res_model">hr.employee</field>
|
|
<field name="view_mode">list</field>
|
|
<field name="view_id" ref="hr_employee_view_list_planning_role_editor"/>
|
|
<field name="domain">[('active', '=', True)]</field>
|
|
<field name="context">{'search_default_group_department': 1}</field>
|
|
<field name="help" type="html">
|
|
<p class="o_view_nocontent_smiling_face">
|
|
Set the Default Role and allowed Roles for each employee
|
|
</p>
|
|
<p>
|
|
Click any cell under <b>Default Role</b> or <b>All Allowed Roles</b>
|
|
and start typing. Changes save automatically. The Default Role
|
|
fills in for every new shift you create for that employee.
|
|
</p>
|
|
</field>
|
|
</record>
|
|
|
|
<!-- Menu item under Planning → Configuration -->
|
|
<menuitem
|
|
id="planning_menu_settings_employee_roles"
|
|
name="Employee Roles"
|
|
parent="planning.planning_menu_settings"
|
|
sequence="13"
|
|
action="hr_employee_action_planning_role_editor"
|
|
groups="planning.group_planning_manager"/>
|
|
|
|
</odoo>
|