Files
Odoo-Modules/fusion_plating/fusion_plating_certificates/views/fp_certificate_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

260 lines
14 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- ============================================================ -->
<!-- LIST VIEW -->
<!-- ============================================================ -->
<record id="fp_certificate_view_list" model="ir.ui.view">
<field name="name">fp.certificate.list</field>
<field name="model">fp.certificate</field>
<field name="arch" type="xml">
<list default_order="issue_date desc"
decoration-muted="state == 'draft'"
decoration-success="state == 'issued'"
decoration-danger="state == 'voided'">
<field name="issue_date"/>
<field name="name"/>
<field name="certificate_type" widget="badge"/>
<field name="partner_id"/>
<field name="part_number"/>
<field name="po_number"/>
<field name="entech_wo_number"/>
<field name="process_description"/>
<field name="quantity_shipped"/>
<field name="issued_by_id"/>
<field name="state" widget="badge"
decoration-info="state == 'draft'"
decoration-success="state == 'issued'"
decoration-danger="state == 'voided'"/>
</list>
</field>
</record>
<!-- ============================================================ -->
<!-- FORM VIEW -->
<!-- ============================================================ -->
<record id="fp_certificate_view_form" model="ir.ui.view">
<field name="name">fp.certificate.form</field>
<field name="model">fp.certificate</field>
<field name="arch" type="xml">
<form>
<header>
<!-- Phase D5 — Nadcap-cert restriction enforced at MODEL
layer via ir.rule (rule_fp_certificate_nadcap_qm_only
in fp_cert_security.xml). Single Issue button visible
to all Manager+ when state=draft. Manager clicking
Issue on a Nadcap cert gets AccessError from the rule.
(Strategy B with user_has_groups() inside invisible=
was rejected by Odoo 19 view validator — see CLAUDE.md
rule 13f.) -->
<button name="action_issue" string="Issue"
type="object" class="btn-primary"
invisible="state != 'draft'"/>
<!-- Print = the same EN report action the gear-menu
Print > Certificate of Conformance (English)
calls. Routes through fusion_pdf_preview's
report interceptor automatically. For the
French variant or any other language report,
use the gear menu. -->
<button name="%(fusion_plating_reports.action_report_coc_en)d"
string="Print"
type="action" class="btn-secondary"
icon="fa-print"/>
<button name="action_open_void_wizard" string="Void"
type="object" class="btn-danger"
invisible="state != 'issued'"/>
<button name="action_send_to_customer" string="Send to Customer"
type="object"
invisible="state != 'issued'"/>
<button name="action_reset_to_draft" string="Reset to Draft"
type="object" class="btn-secondary"
icon="fa-undo"
confirm="Reset this certificate to draft? You'll be able to edit and re-issue. The previously-issued PDF stays attached for audit."
invisible="state == 'draft'"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,issued"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_view_traceability"
type="object"
class="oe_stat_button"
icon="fa-sitemap"
invisible="batch_count == 0">
<field name="batch_count" widget="statinfo"
string="Batches"/>
</button>
</div>
<div class="oe_title">
<h1>
<field name="name" readonly="1"/>
</h1>
</div>
<!-- Main info — collapsed from 3 separate groups
into 1 to eliminate the dead rows that
appeared when one sub-group ran shorter than
the other. Left column is identity / signer /
dates; right column is part / process / qty /
derived stats. Reorganized 2026-05-21. -->
<group>
<group>
<field name="certificate_type"/>
<field name="partner_id"/>
<field name="contact_partner_id"
options="{'no_create': True}"
invisible="not partner_id"/>
<field name="sale_order_id"/>
<field name="entech_wo_number"/>
<field name="portal_job_id"/>
<field name="issue_date"/>
<field name="issued_by_id"/>
<field name="certified_by_id"/>
<field name="body_style"/>
</group>
<group>
<field name="part_number"/>
<field name="process_description"/>
<field name="spec_reference"/>
<field name="po_number"/>
<field name="customer_job_no"/>
<field name="quantity_shipped"/>
<field name="nc_quantity"/>
<field name="reading_count" readonly="1"/>
<field name="mean_nip_mils" readonly="1"/>
</group>
</group>
<!-- SPC rebalanced — spec/min/max on the left,
derived stats on the right; trend_explanation
spans both columns so the long message doesn't
get cropped. -->
<group string="SPC — Statistical Process Control">
<group>
<field name="spec_min_mils"/>
<field name="spec_max_mils"/>
<field name="min_reading_mils" readonly="1"/>
<field name="max_reading_mils" readonly="1"/>
</group>
<group>
<field name="std_dev_mils" readonly="1"/>
<field name="cpk" readonly="1"/>
<field name="cpk_status" readonly="1" widget="badge"
decoration-success="cpk_status in ('capable','excellent')"
decoration-warning="cpk_status == 'marginal'"
decoration-danger="cpk_status == 'incapable'"
decoration-muted="cpk_status == 'insufficient'"/>
<field name="trend_alert" readonly="1" widget="badge"
decoration-success="trend_alert == 'ok'"
decoration-warning="trend_alert == 'warning'"
decoration-danger="trend_alert == 'alert'"/>
</group>
<field name="trend_explanation" readonly="1" colspan="2"
invisible="trend_alert == 'ok'"/>
</group>
<notebook>
<page string="Thickness Readings" name="readings">
<field name="thickness_reading_ids">
<list editable="bottom">
<field name="reading_number"/>
<field name="nip_mils"/>
<field name="ni_percent"/>
<field name="p_percent"/>
<field name="position_label"/>
<field name="equipment_model"/>
<field name="operator_id"/>
<field name="reading_datetime"/>
</list>
</field>
</page>
<page string="Certificate PDF" name="pdf">
<group>
<field name="attachment_id"/>
</group>
</page>
<page string="Void" name="void"
invisible="state != 'voided'">
<field name="void_reason"/>
</page>
<page string="Notes" name="notes">
<field name="notes"/>
</page>
</notebook>
</sheet>
<chatter>
<field name="message_follower_ids"/>
<field name="activity_ids"/>
<field name="message_ids"/>
</chatter>
</form>
</field>
</record>
<!-- ============================================================ -->
<!-- SEARCH VIEW -->
<!-- ============================================================ -->
<record id="fp_certificate_view_search" model="ir.ui.view">
<field name="name">fp.certificate.search</field>
<field name="model">fp.certificate</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="partner_id"/>
<field name="part_number"/>
<field name="po_number"/>
<field name="entech_wo_number"/>
<separator/>
<filter name="filter_coc" string="CoC"
domain="[('certificate_type', '=', 'coc')]"/>
<filter name="filter_thickness" string="Thickness Report"
domain="[('certificate_type', '=', 'thickness_report')]"/>
<filter name="filter_mill_test" string="Mill Test"
domain="[('certificate_type', '=', 'mill_test')]"/>
<filter name="filter_nadcap" string="Nadcap"
domain="[('certificate_type', '=', 'nadcap_cert')]"/>
<separator/>
<filter name="filter_draft" string="Draft"
domain="[('state', '=', 'draft')]"/>
<filter name="filter_issued" string="Issued"
domain="[('state', '=', 'issued')]"/>
<filter name="filter_voided" string="Voided"
domain="[('state', '=', 'voided')]"/>
<separator/>
<filter name="filter_this_week" string="This Week"
domain="[('issue_date', '>=', (context_today() - relativedelta(weeks=1)).strftime('%Y-%m-%d'))]"/>
<filter name="filter_this_month" string="This Month"
domain="[('issue_date', '>=', context_today().strftime('%Y-%m-01'))]"/>
<separator/>
<group>
<filter name="group_customer" string="Customer"
context="{'group_by': 'partner_id'}"/>
<filter name="group_type" string="Type"
context="{'group_by': 'certificate_type'}"/>
<filter name="group_issued_by" string="Issued By"
context="{'group_by': 'issued_by_id'}"/>
<filter name="group_month" string="Month"
context="{'group_by': 'issue_date:month'}"/>
</group>
</search>
</field>
</record>
<!-- ============================================================ -->
<!-- WINDOW ACTION -->
<!-- ============================================================ -->
<record id="action_fp_certificate" model="ir.actions.act_window">
<field name="name">Certificates</field>
<field name="res_model">fp.certificate</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="fp_certificate_view_search"/>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create your first certificate
</p>
<p>
Certificates of Conformance, thickness reports, and other quality
documents are tracked here.
</p>
</field>
</record>
</odoo>