Files
Odoo-Modules/fusion_plating/fusion_plating_quality/views/fp_capa_views.xml
gsinghpal 7bcbcb4008 fix(plating-perms): deploy-time cascade fixes from entech I3
5 fixes discovered during the live deploy to entech LXC 111:

1. pre-migrate.py to rename old configurator's 'Shop Manager' group BEFORE
   new core 'Shop Manager v2' XML loads (cross-module name collision on
   res_groups_name_uniq).

2. res_company_views.xml: dropped ref() inside <field domain=> attribute
   (Odoo 19 view validator interprets it as a field name).

3. sale_order_views.xml: replaced 3 separate xpaths for amount_total /
   amount_untaxed / amount_tax with a single xpath on tax_totals widget
   (Odoo 19 sale.view_order_form uses one widget instead of separate fields).

4. fp_cert_security.xml: certificate_type field, not cert_type. FAIR is a
   separate model so the rule only restricts cert_type='nadcap_cert' now.

5. fp_certificate_views.xml + fp_capa_views.xml + fp_customer_spec_views.xml:
   stripped user_has_groups() from invisible= / readonly= attrs (Odoo 19
   view validator interprets as field name). Model-layer ACLs and ir.rules
   already enforce the same restrictions.

Also fixed res.groups.users -> user_ids in fp_migration.py (Odoo 19 rename,
caught when manually invoking _fp_notify_owners post-deploy).

CLAUDE.md updated with 4 new rules (13e cross-module name collisions,
13f ref() in domain, 13g tax_totals widget, 13h user_has_groups in attrs).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-24 09:07:13 -04:00

189 lines
9.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2026 Nexa Systems Inc.
License OPL-1 (Odoo Proprietary License v1.0)
Part of the Fusion Plating product family.
-->
<odoo>
<record id="view_fp_capa_list" model="ir.ui.view">
<field name="name">fp.capa.list</field>
<field name="model">fusion.plating.capa</field>
<field name="arch" type="xml">
<list string="CAPAs"
decoration-muted="state == 'closed'"
decoration-danger="is_overdue == True">
<field name="name"/>
<field name="type"/>
<field name="ncr_id"/>
<field name="owner_id"/>
<field name="due_date"/>
<field name="is_overdue" widget="boolean_toggle" optional="hide"/>
<field name="state" widget="badge"
decoration-info="state == 'analysis'"
decoration-warning="state == 'implementation'"
decoration-success="state == 'effective'"
decoration-danger="state == 'not_effective'"
decoration-muted="state == 'closed'"/>
</list>
</field>
</record>
<record id="view_fp_capa_form" model="ir.ui.view">
<field name="name">fp.capa.form</field>
<field name="model">fusion.plating.capa</field>
<field name="arch" type="xml">
<form string="CAPA">
<header>
<!-- Phase D5 — every state-transition button is QM-only.
Per spec section 2.C, Manager has read+comment only;
QM owns CRUD + close + effectiveness verification. -->
<button name="action_start_analysis" string="Start Analysis" type="object"
class="oe_highlight" invisible="state != 'draft'"
groups="fusion_plating.group_fp_quality_manager"/>
<button name="action_start_implementation" string="Implement" type="object"
invisible="state != 'analysis'"
groups="fusion_plating.group_fp_quality_manager"/>
<button name="action_start_verification" string="Verify" type="object"
invisible="state != 'implementation'"
groups="fusion_plating.group_fp_quality_manager"/>
<button name="action_mark_effective" string="Mark Effective" type="object"
class="oe_highlight" invisible="state != 'verification'"
groups="fusion_plating.group_fp_quality_manager"/>
<button name="action_mark_not_effective" string="Not Effective" type="object"
invisible="state != 'verification'"
groups="fusion_plating.group_fp_quality_manager"/>
<button name="action_close" string="Close" type="object"
invisible="state not in ('effective','not_effective')"
groups="fusion_plating.group_fp_quality_manager"/>
<button name="action_reset_to_draft" string="Reset" type="object"
invisible="state == 'draft'"
groups="fusion_plating.group_fp_quality_manager"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,analysis,implementation,verification,effective,closed"/>
</header>
<sheet>
<div class="oe_title">
<label for="name"/>
<h1><field name="name" readonly="1"/></h1>
</div>
<!-- Phase D5 — editable fields readonly for non-QM. Per
spec section 2.C, Manager retains read+comment only;
QM owns CRUD. Form stays visible (Manager needs to
read + chatter); only the inputs lock for non-QM. -->
<group>
<group>
<field name="type"
/>
<field name="ncr_id"
/>
<field name="facility_id" readonly="1"/>
<field name="owner_id"
/>
</group>
<group>
<field name="due_date"
/>
<field name="is_overdue" readonly="1"/>
<field name="verification_date"
/>
<field name="verification_by_id"
/>
<field name="is_effective" readonly="1"/>
</group>
</group>
<notebook>
<page string="Description">
<field name="description"
/>
</page>
<page string="Root Cause Analysis">
<field name="root_cause_analysis"
placeholder="5 Whys, fishbone, or any other structured method."
/>
</page>
<page string="Action Plan">
<field name="action_plan"
/>
</page>
<page string="Effectiveness">
<field name="effectiveness_notes"
/>
</page>
</notebook>
</sheet>
<chatter/>
</form>
</field>
</record>
<record id="view_fp_capa_kanban" model="ir.ui.view">
<field name="name">fp.capa.kanban</field>
<field name="model">fusion.plating.capa</field>
<field name="arch" type="xml">
<kanban default_group_by="state" class="o_fp_capa_kanban">
<field name="id"/>
<field name="name"/>
<field name="type"/>
<field name="owner_id"/>
<field name="due_date"/>
<field name="is_overdue"/>
<templates>
<t t-name="card">
<div class="o_fp_card o_fp_capa_card"
t-att-data-overdue="record.is_overdue.raw_value">
<div class="d-flex justify-content-between align-items-start">
<strong class="o_fp_card_title"><field name="name"/></strong>
<span class="o_fp_capa_type" t-att-data-type="record.type.raw_value">
<field name="type"/>
</span>
</div>
<div class="small text-muted mt-1">
<i class="fa fa-user me-1"/><field name="owner_id"/>
</div>
<div class="small">
<i class="fa fa-calendar me-1 text-muted"/>
<field name="due_date"/>
<span t-if="record.is_overdue.raw_value" class="o_fp_overdue ms-1">OVERDUE</span>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="view_fp_capa_search" model="ir.ui.view">
<field name="name">fp.capa.search</field>
<field name="model">fusion.plating.capa</field>
<field name="arch" type="xml">
<search string="CAPAs">
<field name="name"/>
<field name="ncr_id"/>
<field name="owner_id"/>
<separator/>
<filter string="Open" name="open" domain="[('state','not in',['effective','closed'])]"/>
<filter string="Closed" name="closed" domain="[('state','=','closed')]"/>
<filter string="Overdue" name="overdue" domain="[('is_overdue','=',True)]"/>
<filter string="Corrective" name="corrective" domain="[('type','=','corrective')]"/>
<filter string="Preventive" name="preventive" domain="[('type','=','preventive')]"/>
<separator/>
<filter string="Archived" name="inactive" domain="[('active','=',False)]"/>
<group>
<filter string="Status" name="group_state" context="{'group_by':'state'}"/>
<filter string="Type" name="group_type" context="{'group_by':'type'}"/>
<filter string="Owner" name="group_owner" context="{'group_by':'owner_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_fp_capa" model="ir.actions.act_window">
<field name="name">CAPAs</field>
<field name="res_model">fusion.plating.capa</field>
<field name="view_mode">kanban,list,form</field>
<field name="search_view_id" ref="view_fp_capa_search"/>
</record>
</odoo>