odex25_standard/odex25_base/system_dashboard_classic/views/config.xml

199 lines
11 KiB
XML

<?xml version="1.0"?>
<odoo>
<!-- Dashboard Builder - Enhanced Form View -->
<record id="view_base_dashboard_form" model="ir.ui.view">
<field name="name">Dashboard Builder</field>
<field name="model">base.dashbord</field>
<field name="arch" type="xml">
<form string="Dashboard Service Configuration">
<sheet>
<!-- Avatar / Icon Selection -->
<!-- Avatar / Icon Selection -->
<div class="oe_title">
<label for="icon_type" class="oe_edit_only"/>
<field name="icon_type" widget="radio" class="oe_edit_only" options="{'horizontal': true}"/>
</div>
<!-- Image Widget (Visible if 'image') - NOT REQUIRED -->
<field name="card_image" widget="image" class="oe_avatar"
options="{'preview_image': 'card_image'}"
attrs="{'invisible': [('icon_type', '=', 'icon')]}"/>
<!-- Icon Preview Widget (Visible if 'icon') -->
<field name="icon_preview_html" widget="html" class="oe_avatar"
style="padding:0; border:none; background:transparent;"
attrs="{'invisible': [('icon_type', '=', 'image')]}"/>
<div class="oe_title">
<h1>
<field name="name" placeholder="Service Name" required="True"/>
</h1>
<div attrs="{'invisible': [('icon_type', '=', 'image')]}" class="o_row">
<!-- NOTE: Removed required attr to allow default fallback -->
<field name="icon_name" placeholder="fa-plane"/>
<a href="https://fontawesome.com/v4/icons/" target="_blank" class="btn btn-link" role="button">
<i class="fa fa-external-link"/> Browse Icons
</a>
</div>
</div>
<!-- Main Configuration Groups -->
<group>
<group string="Model Configuration">
<field name="model_id"
options="{'no_create_edit': True}"
required="1"/>
<field name="model_name" invisible="1"/>
<field name="action_id"
options="{'no_create_edit': True}"
domain="[('res_model','=',model_name)]"
required="1"
help="The action to open when clicking this card"/>
</group>
<group string="Display Options">
<field name="sequence" help="Lower numbers appear first"/>
<field name="is_self_service"
help="Enable for employee self-service cards" widget="boolean_toggle"/>
<field name="is_financial_impact"
help="Mark if this service has no financial impact" widget="boolean_toggle"/>
</group>
</group>
<group>
<group string="Employee Filter Configuration">
<field name="search_field"
placeholder="e.g., employee_id.user_id or user_id"
help="The field path used to filter records for current user.&#10;&#10;Examples:&#10;• 'employee_id.user_id' - For HR models (hr.leave, hr.expense, etc.)&#10;• 'user_id' - For models with direct user reference (purchase.order, etc.)&#10;• 'create_uid' - For records created by the user"/>
</group>
<group string="Advanced View Settings"
attrs="{'invisible': [('model_id', '=', False)]}">
<field name="form_view_id"
options="{'no_create_edit': True}"
domain="[('type','=','form'),('model','=',model_name)]"
help="Optional: Custom form view for this service"/>
<field name="list_view_id"
options="{'no_create_edit': True}"
domain="[('type','=','tree'),('model','=',model_name)]"
help="Optional: Custom list view for this service"/>
</group>
</group>
<!-- Hidden computed fields -->
<field name="action_domain" invisible="1"/>
<field name="action_context" invisible="1"/>
<field name="is_button" invisible="1"/>
<field name="is_stage" invisible="1"/>
<field name="is_double" invisible="1"/>
<field name="is_state" invisible="1"/>
<!-- State/Stage Configuration Notebook -->
<notebook>
<page name="state_config" string="State/Stage Configuration">
<!-- Initial state - show info and load button -->
<div attrs="{'invisible': [('is_button', '=', True)]}">
<div class="alert alert-info" role="alert">
<i class="fa fa-info-circle"/> Click the button below to detect available states/stages for the selected model.
</div>
<button name="compute_selection"
string="Load Model States"
type="object"
class="btn-primary"
icon="fa-download"/>
</div>
<!-- After loading - show action buttons above the list -->
<div class="d-flex mb-3" attrs="{'invisible': [('is_button', '=', False)]}">
<button name="update_selection"
string="Refresh States"
type="object"
class="btn-primary"
icon="fa-refresh"/>
<button name="unlink_nodes"
string="Remove All States"
type="object"
class="btn-danger ml-2"
icon="fa-trash"
confirm="Are you sure you want to remove all loaded states?"/>
</div>
<field name="line_ids"
attrs="{'invisible': [('is_button', '=', False)]}"
context="{'default_model_name':model_name,'default_model_id':model_id}">
<tree editable="bottom">
<field name="sequence" widget="handle"/>
<field name="group_ids"
widget="many2many_tags"
options="{'no_quick_create': True, 'color_field': 'color'}"
required="1"
placeholder="Select user groups..."/>
<field name="model_name" invisible="1"/>
<field name="model_id" invisible="1"/>
<field name="state_id"
attrs="{'column_invisible': [('parent.is_state', '=', False), ('parent.is_double', '=', False)]}"
options="{'no_create': True, 'no_create_edit': True}"
domain="[('model_id', '=', model_id)]"/>
<field name="stage_id"
attrs="{'column_invisible': [('parent.is_stage', '=', False)]}"
options="{'no_create': True, 'no_create_edit': True}"
domain="[('model_id', '=', model_id)]"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<!-- Dashboard Builder - Enhanced Tree View -->
<record id="view_base_dashboard_tree" model="ir.ui.view">
<field name="name">Dashboard Builder</field>
<field name="model">base.dashbord</field>
<field name="arch" type="xml">
<tree string="Dashboard Services" default_order="sequence">
<field name="sequence" widget="handle"/>
<!-- Unified Preview Column -->
<field name="icon_preview_html" widget="html" string="Icon/Image"/>
<field name="card_image" invisible="1"/> <!-- explicit card_image kept invisible if needed by logic -->
<field name="name"/>
<field name="model_id"/>
<field name="is_self_service" widget="boolean_toggle"/>
<field name="action_id"/>
<field name="search_field"/>
</tree>
</field>
</record>
<!-- Dashboard Builder Action -->
<record id="base_dashboard_action" model="ir.actions.act_window">
<field name="name">Dashboard Builder</field>
<field name="res_model">base.dashbord</field>
<field name="type">ir.actions.act_window</field>
<field name="context">{}</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create your first dashboard service
</p>
<p>
Configure which Odoo models appear as service cards on the employee dashboard.
</p>
</field>
</record>
<!-- Menu Items -->
<menuitem id="base_dashboard_root"
parent="system_dashboard_classic_menu"
name="Configuration"
groups="system_dashboard_classic.system_board_group_configurations"
sequence="-7"/>
<menuitem id="base_dashboard"
parent="base_dashboard_root"
name="Dashboard Builder"
action="base_dashboard_action"
groups="system_dashboard_classic.system_board_group_configurations"
sequence="-7"/>
</odoo>