Files
Odoo-Modules/fusion_plating/fusion_plating/views/fp_job_views.xml
gsinghpal 2d9779047b fix(jobs): registry load failure after Tier 2/3 persistence patches
Two compounding issues introduced by the persistence audit work:

1. fields.Text mismatch: sale.order.x_fc_internal_note and
   x_fc_external_note are actually fields.Html. I declared the
   sale.order.line related mirrors and the fp.job stored copies as
   fields.Text, so setup_related raised:
     TypeError: Type of related field
     sale.order.line.x_fc_internal_note is inconsistent with
     sale.order.x_fc_internal_note
   Fixed by switching both Note fields on fp.job and sale.order.line
   to fields.Html.

2. Module-load-order: Tier 3 fields (x_fc_delivery_method,
   x_fc_ship_via, x_fc_invoice_strategy) are defined in
   fusion_plating_jobs (related to sale.order via _inherit), but I
   referenced them in fusion_plating core's fp_job_views.xml — which
   loads BEFORE fusion_plating_jobs registers the fields. View
   validator raised "Field x_fc_delivery_method does not exist".
   Fixed by removing those 3 fields from the core view group and
   adding them via xpath in fusion_plating_jobs's fp_job_form_inherit
   (which loads after the fields are registered).

Both fixes deployed and verified — registry loads in 2s, all field
types match, related path resolves correctly. No data loss; the
fp.job rows that already had stored Text content for internal_note /
external_note will carry over into the Html field intact.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-12 08:45:59 -04:00

147 lines
7.2 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_fp_job_list" model="ir.ui.view">
<field name="name">fp.job.list</field>
<field name="model">fp.job</field>
<field name="arch" type="xml">
<list decoration-info="state=='confirmed'"
decoration-success="state=='done'"
decoration-muted="state=='cancelled'">
<field name="name"/>
<field name="partner_id"/>
<field name="qty"/>
<field name="date_deadline"/>
<field name="state"/>
<field name="step_progress_pct" widget="progressbar"/>
<field name="current_location"/>
</list>
</field>
</record>
<record id="view_fp_job_form" model="ir.ui.view">
<field name="name">fp.job.form</field>
<field name="model">fp.job</field>
<field name="arch" type="xml">
<form>
<header>
<button name="action_confirm" type="object"
string="Confirm" class="btn-primary"
invisible="state != 'draft'"/>
<button name="action_cancel" type="object"
string="Cancel"
invisible="state in ('done', 'cancelled')"/>
<field name="state" widget="statusbar"
statusbar_visible="draft,confirmed,in_progress,done"/>
</header>
<sheet>
<div class="oe_title">
<h1><field name="display_name" readonly="1"/></h1>
</div>
<group name="x_fc_customer_refs">
<field name="x_fc_customer_job_number"/>
<field name="x_fc_po_number"/>
<field name="x_fc_rush_order"/>
<field name="x_fc_planned_start_date"/>
<field name="x_fc_internal_deadline"/>
</group>
<group name="x_fc_notes" string="Notes">
<field name="x_fc_internal_note" nolabel="1" placeholder="Internal note (not shown to customer)…"/>
<field name="x_fc_external_note" nolabel="1" placeholder="External note (printed on customer paperwork)…"/>
</group>
<group>
<group>
<field name="partner_id"/>
<field name="product_id"/>
<field name="qty"/>
<field name="priority"/>
</group>
<group>
<field name="date_deadline"/>
<field name="date_planned_start"/>
<field name="date_started" readonly="1"/>
<field name="date_finished" readonly="1"/>
<field name="facility_id"/>
<field name="manager_id"/>
</group>
</group>
<notebook>
<page string="Steps" name="steps">
<field name="step_ids">
<list editable="bottom">
<field name="sequence" widget="handle"/>
<field name="name"/>
<field name="work_centre_id"/>
<field name="kind"/>
<field name="state"/>
<field name="assigned_user_id"/>
<field name="duration_expected"/>
<field name="duration_actual" readonly="1"/>
</list>
</field>
</page>
<page string="Source" name="source">
<group>
<field name="origin"/>
<field name="sale_order_id"/>
<field name="recipe_id"/>
<field name="start_at_node_id"/>
</group>
</page>
<page string="Costs" name="costs">
<group>
<field name="quoted_revenue"/>
<field name="actual_cost"/>
<field name="margin"/>
<field name="margin_pct"/>
<field name="currency_id" invisible="1"/>
</group>
</page>
</notebook>
</sheet>
<chatter/>
</form>
</field>
</record>
<record id="view_fp_job_search" model="ir.ui.view">
<field name="name">fp.job.search</field>
<field name="model">fp.job</field>
<field name="arch" type="xml">
<search>
<field name="name"/>
<field name="partner_id"/>
<separator/>
<!-- Sub 12d — "Open" is the default surface managers want.
Hides Done + Cancelled jobs out of the box; the
other state filters below let them be re-included. -->
<filter name="open_jobs" string="Open"
domain="[('state','not in',('done','cancelled'))]"/>
<separator/>
<filter name="state_draft" string="Draft" domain="[('state','=','draft')]"/>
<filter name="state_confirmed" string="Confirmed" domain="[('state','=','confirmed')]"/>
<filter name="state_in_progress" string="In Progress" domain="[('state','=','in_progress')]"/>
<filter name="state_on_hold" string="On Hold" domain="[('state','=','on_hold')]"/>
<filter name="state_done" string="Done" domain="[('state','=','done')]"/>
<filter name="state_cancelled" string="Cancelled" domain="[('state','=','cancelled')]"/>
<separator/>
<filter name="rush" string="Rush" domain="[('priority','=','rush')]"/>
<group>
<filter name="group_state" string="Status" context="{'group_by': 'state'}"/>
<filter name="group_partner" string="Customer" context="{'group_by': 'partner_id'}"/>
<filter name="group_facility" string="Facility" context="{'group_by': 'facility_id'}"/>
</group>
</search>
</field>
</record>
<record id="action_fp_job" model="ir.actions.act_window">
<field name="name">Work Orders</field>
<field name="res_model">fp.job</field>
<field name="view_mode">list,form</field>
<field name="search_view_id" ref="view_fp_job_search"/>
<!-- Default to the Open filter so Done jobs don't clutter the
managerial surface. Users can untick to see history. -->
<field name="context">{'search_default_open_jobs': 1}</field>
</record>
</odoo>