feat(thickness): single Char range field — drop fp.recipe.thickness picker
Per client direction: every order is a thickness RANGE (e.g. "0.0005-0.0008 mils" or "5-10 mils"), never a single value. The old picker model (fp.recipe.thickness with a single 'value' Float) was modelling the wrong concept and overcrowding the order entry UI. Replaced with one free-text Char field that auto-fills from last-used or part default. DELETED entirely: - fp.recipe.thickness model (file + view + ACL + manifest entry) - recipe.thickness_option_ids One2many (the picker source) - "Thickness Options" inline list on the recipe form - sale.order.line.x_fc_thickness_id (M2O picker) - account.move.line.x_fc_thickness_id - fp.delivery.x_fc_thickness_id - fp.direct.order.line.thickness_id ADDED: - sale.order.line.x_fc_thickness_range (Char) — operator types range - account.move.line.x_fc_thickness_range — for invoice rendering - fp.delivery.x_fc_thickness_range — for packing slip - fp.direct.order.line.thickness_range — for the wizard - fp.part.catalog.x_fc_default_thickness_range — part default AUTO-FILL CHAIN (sale.order.line + wizard line): 1. Operator already typed → keep 2. Most recent SO line for (this part, this customer) with a non-empty thickness_range → copy that 3. part.x_fc_default_thickness_range → copy 4. Blank — operator types Implemented as both an @api.onchange (interactive) AND a create() override (programmatic — wizard, sale_mrp bridge, imports). Same logic in both paths. WIZARD push-to-defaults: when "Save as Default" toggle is ticked on a wizard line, persist the line's thickness_range to part.x_fc_default_thickness_range so future first-customer orders get a sensible starting point. REPORTS: customer_line_header.xml + report_fp_wo_sticker.xml now print the Char range as-typed (no display_name lookup needed). KEPT (admin documentation only — doesn't affect order entry): - recipe.thickness_min, thickness_max, thickness_uom on the recipe root: documents the recipe's CAPABILITY range. No UI gate; just for spec authors to record what the chemistry can produce. JOB GROUPING: fp.job auto-create groups SO lines by (recipe, part, spec, thickness, serial). Updated to key on the thickness_range Char (stripped) instead of the deleted thickness_id integer. DB cleanup: --update=base ran on the upgrade, dropping the fp_recipe_thickness table + the four x_fc_thickness_id columns. Existing data was already nulled in earlier dev work. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,7 +18,6 @@ from . import fp_bath_log_line
|
||||
from . import fp_bath_parameter
|
||||
from . import fp_bath_replenishment_rule
|
||||
from . import fp_process_node
|
||||
from . import fp_recipe_thickness
|
||||
from . import fp_rack
|
||||
from . import fp_job
|
||||
from . import fp_job_step
|
||||
|
||||
@@ -357,13 +357,10 @@ class FpProcessNode(models.Model):
|
||||
[('mils', 'mils'), ('microns', 'microns'), ('inches', 'inches')],
|
||||
string='Thickness UoM', default='mils',
|
||||
)
|
||||
thickness_option_ids = fields.One2many(
|
||||
'fp.recipe.thickness',
|
||||
'recipe_id',
|
||||
string='Thickness Options',
|
||||
help='Discrete thickness values offered to the estimator on the '
|
||||
'order line for jobs running this recipe.',
|
||||
)
|
||||
# thickness_option_ids removed — fp.recipe.thickness model deleted.
|
||||
# Thickness on the SO line is now a free-text Char range (e.g.
|
||||
# "0.0005-0.0008 mils") that auto-fills from last-used per
|
||||
# (part, customer) or the part's x_fc_default_thickness_range.
|
||||
|
||||
# ---- Bake relief — AMS 2759/9 hydrogen embrittlement (recipe root) ----
|
||||
requires_bake_relief = fields.Boolean(
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2026 Nexa Systems Inc.
|
||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||
# Part of the Fusion Plating product family.
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class FpRecipeThickness(models.Model):
|
||||
"""Discrete thickness option offered for a recipe.
|
||||
|
||||
Replaces fp.coating.thickness. The thickness picker on the SO line
|
||||
is scoped to the chosen recipe, so the operator only sees values
|
||||
that match what the recipe actually produces.
|
||||
"""
|
||||
_name = 'fp.recipe.thickness'
|
||||
_description = 'Fusion Plating — Recipe Thickness Option'
|
||||
_order = 'recipe_id, sequence, value'
|
||||
|
||||
recipe_id = fields.Many2one(
|
||||
'fusion.plating.process.node',
|
||||
string='Recipe',
|
||||
required=True,
|
||||
ondelete='cascade',
|
||||
domain="[('node_type', '=', 'recipe'), ('parent_id', '=', False)]",
|
||||
)
|
||||
sequence = fields.Integer(default=10)
|
||||
value = fields.Float(
|
||||
string='Thickness',
|
||||
required=True,
|
||||
digits=(10, 4),
|
||||
)
|
||||
uom = fields.Selection(
|
||||
[('mils', 'mils'), ('microns', 'microns'), ('inches', 'inches')],
|
||||
string='UoM',
|
||||
required=True,
|
||||
default='mils',
|
||||
)
|
||||
label = fields.Char(
|
||||
string='Display Label',
|
||||
compute='_compute_label',
|
||||
store=True,
|
||||
help='Auto-formatted "0.0005 mils" string for the picker dropdown.',
|
||||
)
|
||||
note = fields.Char(string='Note')
|
||||
active = fields.Boolean(default=True)
|
||||
|
||||
@api.depends('value', 'uom')
|
||||
def _compute_label(self):
|
||||
for rec in self:
|
||||
rec.label = f'{rec.value:g} {rec.uom}' if rec.value else ''
|
||||
|
||||
def name_get(self):
|
||||
return [(rec.id, rec.label or '?') for rec in self]
|
||||
Reference in New Issue
Block a user