feat(plating-team): Owner-only Team kanban + Designated Official fields

Phase F of permissions overhaul.

Adds res.users.x_fc_plating_role Selection field (8 options matching
the role hierarchy). Compute reads highest plating group from
groups_id (precedence: owner > QM > manager > sales_manager >
shop_manager > sales_rep > technician). Inverse uses sudo().write()
to clear all plating-role groups (additive-by-default m2m (3, id))
then adds the chosen one, and posts a Markup-wrapped chatter audit
naming the actor.

New Owner-only menu: Plating > Configuration > Team. Standard
res.users kanban grouped by x_fc_plating_role with records_draggable
for drag-and-drop role changes. Domain hides shared/portal users
and archived users.

res.company gains two Designated Official fields:
- x_fc_cgp_designated_official_id (CGP DO per Defence Production Act §22)
- x_fc_nadcap_authority_user_id (Nadcap signer)

Both tracking=True for audit. View-level domain restricts picker to
Owner or Quality Manager users via [(ref('...'), ref('...'))] xmlid
domains. New 'Plating Designated Officials' page on res.company form,
Owner-only visibility.

Tests in test_team_page.py cover compute/inverse/chatter/menu.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-05-24 02:03:44 -04:00
parent 830b29ce49
commit 89a937fb32
8 changed files with 336 additions and 1 deletions

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<!-- Owner-only Team page: kanban of internal users grouped by plating role.
Drag-and-drop a card between columns changes the user's role
(inverse handler on res.users.x_fc_plating_role). -->
<record id="view_fp_team_kanban" model="ir.ui.view">
<field name="name">res.users.fp.team.kanban</field>
<field name="model">res.users</field>
<field name="arch" type="xml">
<kanban default_group_by="x_fc_plating_role"
class="o_kanban_small_column"
group_create="false"
group_delete="false"
records_draggable="true">
<field name="id"/>
<field name="x_fc_plating_role"/>
<field name="login"/>
<field name="email"/>
<field name="image_128"/>
<field name="login_date"/>
<field name="name"/>
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_card oe_kanban_global_click">
<div class="o_kanban_image">
<img t-att-src="kanban_image('res.users', 'image_128', record.id.raw_value)"
alt="Photo"/>
</div>
<div class="oe_kanban_details">
<strong><field name="name"/></strong>
<div t-if="record.email.raw_value">
<field name="email"/>
</div>
<div t-if="record.login_date.raw_value" class="text-muted">
Last seen: <field name="login_date" widget="date"/>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="action_fp_team" model="ir.actions.act_window">
<field name="name">Team</field>
<field name="res_model">res.users</field>
<field name="view_mode">kanban,list,form</field>
<field name="domain">[('share', '=', False), ('active', '=', True)]</field>
<field name="context">{'search_default_groupby_plating_role': 1}</field>
</record>
<menuitem id="menu_fp_team"
name="Team"
parent="fusion_plating.menu_fp_config"
action="action_fp_team"
sequence="5"
groups="fusion_plating.group_fp_owner"/>
</data>
</odoo>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="view_company_form_fp_dos" model="ir.ui.view">
<field name="name">res.company.form.fp.designated.officials</field>
<field name="model">res.company</field>
<field name="inherit_id" ref="base.view_company_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook" position="inside">
<page string="Plating Designated Officials"
groups="fusion_plating.group_fp_owner">
<group>
<field name="x_fc_cgp_designated_official_id"
domain="[('groups_id', 'in', [ref('fusion_plating.group_fp_quality_manager'), ref('fusion_plating.group_fp_owner')])]"/>
<field name="x_fc_nadcap_authority_user_id"
domain="[('groups_id', 'in', [ref('fusion_plating.group_fp_quality_manager'), ref('fusion_plating.group_fp_owner')])]"/>
</group>
</page>
</xpath>
</field>
</record>
</data>
</odoo>