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:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Fusion Plating',
|
'name': 'Fusion Plating',
|
||||||
'version': '19.0.19.3.0',
|
'version': '19.0.20.0.0',
|
||||||
'category': 'Manufacturing/Plating',
|
'category': 'Manufacturing/Plating',
|
||||||
'summary': 'Core plating / metal finishing ERP: facilities, processes, tanks, baths, jobs, operators.',
|
'summary': 'Core plating / metal finishing ERP: facilities, processes, tanks, baths, jobs, operators.',
|
||||||
'description': """
|
'description': """
|
||||||
@@ -99,7 +99,6 @@ Copyright (c) 2026 Nexa Systems Inc. All rights reserved.
|
|||||||
'views/fp_facility_views.xml',
|
'views/fp_facility_views.xml',
|
||||||
'views/fp_bath_views.xml',
|
'views/fp_bath_views.xml',
|
||||||
'views/fp_process_node_views.xml',
|
'views/fp_process_node_views.xml',
|
||||||
'views/fp_recipe_thickness_views.xml',
|
|
||||||
# Sub 14b — fp.step.kind catalog. MUST load before
|
# Sub 14b — fp.step.kind catalog. MUST load before
|
||||||
# fp_step_template_data.xml (templates reference kinds via
|
# fp_step_template_data.xml (templates reference kinds via
|
||||||
# kind_id) AND before fp_step_template_views.xml (the form
|
# kind_id) AND before fp_step_template_views.xml (the form
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ from . import fp_bath_log_line
|
|||||||
from . import fp_bath_parameter
|
from . import fp_bath_parameter
|
||||||
from . import fp_bath_replenishment_rule
|
from . import fp_bath_replenishment_rule
|
||||||
from . import fp_process_node
|
from . import fp_process_node
|
||||||
from . import fp_recipe_thickness
|
|
||||||
from . import fp_rack
|
from . import fp_rack
|
||||||
from . import fp_job
|
from . import fp_job
|
||||||
from . import fp_job_step
|
from . import fp_job_step
|
||||||
|
|||||||
@@ -357,13 +357,10 @@ class FpProcessNode(models.Model):
|
|||||||
[('mils', 'mils'), ('microns', 'microns'), ('inches', 'inches')],
|
[('mils', 'mils'), ('microns', 'microns'), ('inches', 'inches')],
|
||||||
string='Thickness UoM', default='mils',
|
string='Thickness UoM', default='mils',
|
||||||
)
|
)
|
||||||
thickness_option_ids = fields.One2many(
|
# thickness_option_ids removed — fp.recipe.thickness model deleted.
|
||||||
'fp.recipe.thickness',
|
# Thickness on the SO line is now a free-text Char range (e.g.
|
||||||
'recipe_id',
|
# "0.0005-0.0008 mils") that auto-fills from last-used per
|
||||||
string='Thickness Options',
|
# (part, customer) or the part's x_fc_default_thickness_range.
|
||||||
help='Discrete thickness values offered to the estimator on the '
|
|
||||||
'order line for jobs running this recipe.',
|
|
||||||
)
|
|
||||||
|
|
||||||
# ---- Bake relief — AMS 2759/9 hydrogen embrittlement (recipe root) ----
|
# ---- Bake relief — AMS 2759/9 hydrogen embrittlement (recipe root) ----
|
||||||
requires_bake_relief = fields.Boolean(
|
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]
|
|
||||||
@@ -94,6 +94,3 @@ access_fp_job_step_move_manager,fp.job.step.move.manager,model_fp_job_step_move,
|
|||||||
access_fp_job_step_move_input_value_operator,fp.job.step.move.input.value.operator,model_fp_job_step_move_input_value,group_fusion_plating_operator,1,1,1,0
|
access_fp_job_step_move_input_value_operator,fp.job.step.move.input.value.operator,model_fp_job_step_move_input_value,group_fusion_plating_operator,1,1,1,0
|
||||||
access_fp_job_step_move_input_value_supervisor,fp.job.step.move.input.value.supervisor,model_fp_job_step_move_input_value,group_fusion_plating_supervisor,1,1,1,0
|
access_fp_job_step_move_input_value_supervisor,fp.job.step.move.input.value.supervisor,model_fp_job_step_move_input_value,group_fusion_plating_supervisor,1,1,1,0
|
||||||
access_fp_job_step_move_input_value_manager,fp.job.step.move.input.value.manager,model_fp_job_step_move_input_value,group_fusion_plating_manager,1,1,1,1
|
access_fp_job_step_move_input_value_manager,fp.job.step.move.input.value.manager,model_fp_job_step_move_input_value,group_fusion_plating_manager,1,1,1,1
|
||||||
access_fp_recipe_thickness_user,fp.recipe.thickness.user,model_fp_recipe_thickness,base.group_user,1,0,0,0
|
|
||||||
access_fp_recipe_thickness_supervisor,fp.recipe.thickness.supervisor,model_fp_recipe_thickness,group_fusion_plating_supervisor,1,1,1,0
|
|
||||||
access_fp_recipe_thickness_manager,fp.recipe.thickness.manager,model_fp_recipe_thickness,group_fusion_plating_manager,1,1,1,1
|
|
||||||
|
|||||||
|
@@ -255,18 +255,14 @@
|
|||||||
<field name="is_locked" widget="boolean_toggle"
|
<field name="is_locked" widget="boolean_toggle"
|
||||||
help="When ON, only managers can edit this recipe and its child operations / steps. Use for NADCAP-qualified processes."/>
|
help="When ON, only managers can edit this recipe and its child operations / steps. Use for NADCAP-qualified processes."/>
|
||||||
</group>
|
</group>
|
||||||
<group string="Thickness Options">
|
<!-- Thickness Options group removed. The
|
||||||
<field name="thickness_option_ids" nolabel="1">
|
fp.recipe.thickness picker model was
|
||||||
<list editable="bottom">
|
retired in favour of a single free-text
|
||||||
<field name="sequence" widget="handle"/>
|
thickness range field on the SO line.
|
||||||
<field name="value"/>
|
Recipe still carries thickness_min /
|
||||||
<field name="uom"/>
|
thickness_max above as documentation
|
||||||
<field name="label" readonly="1"/>
|
of the recipe's capability range. -->
|
||||||
<field name="note" optional="hide"/>
|
|
||||||
<field name="active" optional="hide"/>
|
|
||||||
</list>
|
|
||||||
</field>
|
|
||||||
</group>
|
|
||||||
<!-- Applicable Specifications group is added
|
<!-- Applicable Specifications group is added
|
||||||
by fusion_plating_quality via an inherit
|
by fusion_plating_quality via an inherit
|
||||||
view (the field lives there too). -->
|
view (the field lives there too). -->
|
||||||
|
|||||||
@@ -1,25 +0,0 @@
|
|||||||
<?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_recipe_thickness_list" model="ir.ui.view">
|
|
||||||
<field name="name">fp.recipe.thickness.list</field>
|
|
||||||
<field name="model">fp.recipe.thickness</field>
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<list string="Thickness Options" decoration-muted="not active" editable="bottom">
|
|
||||||
<field name="sequence" widget="handle"/>
|
|
||||||
<field name="recipe_id"/>
|
|
||||||
<field name="value"/>
|
|
||||||
<field name="uom"/>
|
|
||||||
<field name="label" string="Display"/>
|
|
||||||
<field name="note" optional="hide"/>
|
|
||||||
<field name="active" optional="hide"/>
|
|
||||||
</list>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
|
|
||||||
</odoo>
|
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Fusion Plating — Configurator',
|
'name': 'Fusion Plating — Configurator',
|
||||||
'version': '19.0.20.1.0',
|
'version': '19.0.21.0.0',
|
||||||
'category': 'Manufacturing/Plating',
|
'category': 'Manufacturing/Plating',
|
||||||
'summary': 'Quotation configurator with part catalog, coating configs, and formula-based pricing engine.',
|
'summary': 'Quotation configurator with part catalog, coating configs, and formula-based pricing engine.',
|
||||||
'description': """
|
'description': """
|
||||||
|
|||||||
@@ -65,10 +65,9 @@ class AccountMoveLine(models.Model):
|
|||||||
string='Job #', index=True,
|
string='Job #', index=True,
|
||||||
help='Copied from sale.order.line.',
|
help='Copied from sale.order.line.',
|
||||||
)
|
)
|
||||||
x_fc_thickness_id = fields.Many2one(
|
x_fc_thickness_range = fields.Char(
|
||||||
'fp.recipe.thickness',
|
|
||||||
string='Thickness',
|
string='Thickness',
|
||||||
help='Copied from sale.order.line for customer-facing invoice PDFs.',
|
help='Carried from the SO line — prints on the invoice PDF.',
|
||||||
)
|
)
|
||||||
# x_fc_customer_spec_id added by fusion_plating_quality.
|
# x_fc_customer_spec_id added by fusion_plating_quality.
|
||||||
x_fc_revision_snapshot = fields.Char(
|
x_fc_revision_snapshot = fields.Char(
|
||||||
|
|||||||
@@ -279,6 +279,14 @@ class FpPartCatalog(models.Model):
|
|||||||
# ---- Direct-order defaults (Phase C — C4) ----
|
# ---- Direct-order defaults (Phase C — C4) ----
|
||||||
# x_fc_default_customer_spec_id added by fusion_plating_quality.
|
# x_fc_default_customer_spec_id added by fusion_plating_quality.
|
||||||
# Legacy default_coating_config_id + default_treatment_ids removed.
|
# Legacy default_coating_config_id + default_treatment_ids removed.
|
||||||
|
x_fc_default_thickness_range = fields.Char(
|
||||||
|
string='Default Thickness',
|
||||||
|
help='Default thickness range as free text (e.g. "0.0005-0.0008 mils" '
|
||||||
|
'or "5-10 mils"). Pre-fills the thickness on new sale order '
|
||||||
|
'lines for this part — falls back when no recent order for '
|
||||||
|
'the same (part, customer) pair exists. Updated when the '
|
||||||
|
'wizard\'s "Save as Default" toggle is ticked.',
|
||||||
|
)
|
||||||
|
|
||||||
# Substrate density mapping (g/cm³) for material weight calculation
|
# Substrate density mapping (g/cm³) for material weight calculation
|
||||||
_SUBSTRATE_DENSITY = {
|
_SUBSTRATE_DENSITY = {
|
||||||
|
|||||||
@@ -304,12 +304,13 @@ class SaleOrderLine(models.Model):
|
|||||||
help='Shop-floor reference for this line. Auto-sequenced on sale '
|
help='Shop-floor reference for this line. Auto-sequenced on sale '
|
||||||
'order confirmation; editable. Blank is allowed.',
|
'order confirmation; editable. Blank is allowed.',
|
||||||
)
|
)
|
||||||
x_fc_thickness_id = fields.Many2one(
|
x_fc_thickness_range = fields.Char(
|
||||||
'fp.recipe.thickness',
|
|
||||||
string='Thickness',
|
string='Thickness',
|
||||||
ondelete='set null',
|
help='Target thickness range as the operator types it, e.g. '
|
||||||
domain="[('recipe_id', '=', x_fc_process_variant_id)]",
|
'"0.0005-0.0008 mils" or "5-10 mils". Free-form text — '
|
||||||
help="Target thickness. Options come from the line's recipe.",
|
'auto-fills from the last order for this (part, customer) '
|
||||||
|
'pair, falling back to the part\'s default range. Prints '
|
||||||
|
'verbatim on the cert, packing slip, and invoice.',
|
||||||
)
|
)
|
||||||
x_fc_revision_snapshot = fields.Char(
|
x_fc_revision_snapshot = fields.Char(
|
||||||
string='Revision (snapshot)',
|
string='Revision (snapshot)',
|
||||||
@@ -399,6 +400,32 @@ class SaleOrderLine(models.Model):
|
|||||||
part = Part.browse(vals['x_fc_part_catalog_id']).exists()
|
part = Part.browse(vals['x_fc_part_catalog_id']).exists()
|
||||||
if part and part.revision:
|
if part and part.revision:
|
||||||
vals['x_fc_revision_snapshot'] = part.revision
|
vals['x_fc_revision_snapshot'] = part.revision
|
||||||
|
|
||||||
|
# Auto-fill thickness range — same logic as the onchange but
|
||||||
|
# for programmatic creators (wizard, sale_mrp, imports).
|
||||||
|
# Resolution: explicit > last-used (part, partner) > part default.
|
||||||
|
if (not vals.get('x_fc_thickness_range')
|
||||||
|
and vals.get('x_fc_part_catalog_id')):
|
||||||
|
part = Part.browse(vals['x_fc_part_catalog_id']).exists()
|
||||||
|
if part:
|
||||||
|
# Need partner_id from the parent order
|
||||||
|
partner_id = False
|
||||||
|
if vals.get('order_id'):
|
||||||
|
order = self.env['sale.order'].browse(vals['order_id']).exists()
|
||||||
|
if order:
|
||||||
|
partner_id = order.partner_id.id
|
||||||
|
if partner_id:
|
||||||
|
recent = self.search([
|
||||||
|
('x_fc_part_catalog_id', '=', part.id),
|
||||||
|
('order_id.partner_id', '=', partner_id),
|
||||||
|
('x_fc_thickness_range', '!=', False),
|
||||||
|
('x_fc_thickness_range', '!=', ''),
|
||||||
|
], order='create_date desc', limit=1)
|
||||||
|
if recent:
|
||||||
|
vals['x_fc_thickness_range'] = recent.x_fc_thickness_range
|
||||||
|
if (not vals.get('x_fc_thickness_range')
|
||||||
|
and getattr(part, 'x_fc_default_thickness_range', None)):
|
||||||
|
vals['x_fc_thickness_range'] = part.x_fc_default_thickness_range
|
||||||
lines = super().create(vals_list)
|
lines = super().create(vals_list)
|
||||||
lines._fp_apply_recipe_polish()
|
lines._fp_apply_recipe_polish()
|
||||||
return lines
|
return lines
|
||||||
@@ -473,8 +500,8 @@ class SaleOrderLine(models.Model):
|
|||||||
vals['x_fc_serial_id'] = self.x_fc_serial_id.id
|
vals['x_fc_serial_id'] = self.x_fc_serial_id.id
|
||||||
if self.x_fc_job_number:
|
if self.x_fc_job_number:
|
||||||
vals['x_fc_job_number'] = self.x_fc_job_number
|
vals['x_fc_job_number'] = self.x_fc_job_number
|
||||||
if self.x_fc_thickness_id:
|
if self.x_fc_thickness_range:
|
||||||
vals['x_fc_thickness_id'] = self.x_fc_thickness_id.id
|
vals['x_fc_thickness_range'] = self.x_fc_thickness_range
|
||||||
if self.x_fc_revision_snapshot:
|
if self.x_fc_revision_snapshot:
|
||||||
vals['x_fc_revision_snapshot'] = self.x_fc_revision_snapshot
|
vals['x_fc_revision_snapshot'] = self.x_fc_revision_snapshot
|
||||||
# x_fc_customer_spec_id carry-over is handled by an
|
# x_fc_customer_spec_id carry-over is handled by an
|
||||||
@@ -576,18 +603,41 @@ class SaleOrderLine(models.Model):
|
|||||||
'target': 'current',
|
'target': 'current',
|
||||||
}
|
}
|
||||||
|
|
||||||
@api.onchange('x_fc_process_variant_id')
|
@api.onchange('x_fc_part_catalog_id')
|
||||||
def _onchange_recipe_clears_thickness(self):
|
def _onchange_part_default_thickness(self):
|
||||||
"""Clear the thickness picker when recipe changes.
|
"""Auto-fill thickness range from last-used or part default.
|
||||||
|
|
||||||
Thickness options are scoped to the recipe; a value carried over
|
Resolution order (first match wins):
|
||||||
from a previous recipe would fail its domain.
|
1. Operator already typed a value → keep
|
||||||
|
2. Most recent SO line for (this part, this customer) with a
|
||||||
|
non-empty thickness_range → copy that
|
||||||
|
3. Part's x_fc_default_thickness_range → copy
|
||||||
|
4. Blank — operator types
|
||||||
"""
|
"""
|
||||||
for line in self:
|
for line in self:
|
||||||
if (line.x_fc_thickness_id
|
if line.x_fc_thickness_range:
|
||||||
and line.x_fc_thickness_id.recipe_id
|
continue
|
||||||
!= line.x_fc_process_variant_id):
|
if not line.x_fc_part_catalog_id:
|
||||||
line.x_fc_thickness_id = False
|
continue
|
||||||
|
partner = line.order_id.partner_id
|
||||||
|
# 2. Last-used for (part, customer)
|
||||||
|
if partner:
|
||||||
|
recent = self.env['sale.order.line'].search([
|
||||||
|
('x_fc_part_catalog_id', '=', line.x_fc_part_catalog_id.id),
|
||||||
|
('order_id.partner_id', '=', partner.id),
|
||||||
|
('x_fc_thickness_range', '!=', False),
|
||||||
|
('x_fc_thickness_range', '!=', ''),
|
||||||
|
('id', '!=', line.id or 0),
|
||||||
|
], order='create_date desc', limit=1)
|
||||||
|
if recent:
|
||||||
|
line.x_fc_thickness_range = recent.x_fc_thickness_range
|
||||||
|
continue
|
||||||
|
# 3. Part default
|
||||||
|
part_default = getattr(
|
||||||
|
line.x_fc_part_catalog_id, 'x_fc_default_thickness_range', None,
|
||||||
|
)
|
||||||
|
if part_default:
|
||||||
|
line.x_fc_thickness_range = part_default
|
||||||
|
|
||||||
def action_generate_serial(self):
|
def action_generate_serial(self):
|
||||||
"""Generate one new auto-sequenced serial and append it to the M2M.
|
"""Generate one new auto-sequenced serial and append it to the M2M.
|
||||||
|
|||||||
@@ -203,11 +203,16 @@
|
|||||||
</field>
|
</field>
|
||||||
<!-- Default Specification picker added by
|
<!-- Default Specification picker added by
|
||||||
fusion_plating_quality view inherit. -->
|
fusion_plating_quality view inherit. -->
|
||||||
|
<separator string="Default Thickness" class="mt-4"/>
|
||||||
|
<group>
|
||||||
|
<field name="x_fc_default_thickness_range"
|
||||||
|
placeholder="e.g. 0.0005-0.0008 mils"/>
|
||||||
|
</group>
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
Set a Default Specification on this part
|
Defaults pre-fill new direct-order lines
|
||||||
(under the section added by the Quality
|
for this part. Thickness also auto-fills
|
||||||
module) so future direct-order lines
|
from the most recent order for the same
|
||||||
pre-fill it automatically.
|
(part, customer) pair when one exists.
|
||||||
</p>
|
</p>
|
||||||
</page>
|
</page>
|
||||||
<page string="Dimensions & Complexity" name="dimensions">
|
<page string="Dimensions & Complexity" name="dimensions">
|
||||||
|
|||||||
@@ -118,7 +118,7 @@
|
|||||||
readonly="1">
|
readonly="1">
|
||||||
<list create="false" delete="false" edit="false">
|
<list create="false" delete="false" edit="false">
|
||||||
<field name="x_fc_part_catalog_id"/>
|
<field name="x_fc_part_catalog_id"/>
|
||||||
<field name="x_fc_thickness_id" optional="show"/>
|
<field name="x_fc_thickness_range" optional="show"/>
|
||||||
<field name="x_fc_process_variant_id" optional="show"
|
<field name="x_fc_process_variant_id" optional="show"
|
||||||
string="Process"/>
|
string="Process"/>
|
||||||
<field name="product_uom_qty" string="Qty"/>
|
<field name="product_uom_qty" string="Qty"/>
|
||||||
@@ -260,11 +260,8 @@
|
|||||||
widget="boolean_toggle"
|
widget="boolean_toggle"
|
||||||
invisible="not x_fc_process_variant_id"
|
invisible="not x_fc_process_variant_id"
|
||||||
optional="hide"/>
|
optional="hide"/>
|
||||||
<field name="x_fc_thickness_id"
|
<field name="x_fc_thickness_range"
|
||||||
options="{'no_quick_create': True}"
|
placeholder="e.g. 0.0005-0.0008 mils"
|
||||||
context="{'default_recipe_id': x_fc_process_variant_id}"
|
|
||||||
domain="[('recipe_id', '=', x_fc_process_variant_id)]"
|
|
||||||
invisible="not x_fc_process_variant_id"
|
|
||||||
optional="show"/>
|
optional="show"/>
|
||||||
<field name="x_fc_serial_ids"
|
<field name="x_fc_serial_ids"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
|
|||||||
@@ -394,11 +394,11 @@ class FpDirectOrderLine(models.Model):
|
|||||||
if rec.serial_id and rec.serial_id not in rec.serial_ids:
|
if rec.serial_id and rec.serial_id not in rec.serial_ids:
|
||||||
rec.serial_ids = [(4, rec.serial_id.id)]
|
rec.serial_ids = [(4, rec.serial_id.id)]
|
||||||
job_number = fields.Char(string='Job #')
|
job_number = fields.Char(string='Job #')
|
||||||
thickness_id = fields.Many2one(
|
thickness_range = fields.Char(
|
||||||
'fp.recipe.thickness',
|
|
||||||
string='Thickness',
|
string='Thickness',
|
||||||
domain="[('recipe_id', '=', process_variant_id)]",
|
help='Free-form range, e.g. "0.0005-0.0008 mils" or "5-10 mils". '
|
||||||
ondelete='set null',
|
'Auto-fills from last order for this (part, customer) pair, '
|
||||||
|
'or from the part\'s default range.',
|
||||||
)
|
)
|
||||||
|
|
||||||
# ---- Computes ----
|
# ---- Computes ----
|
||||||
@@ -416,12 +416,36 @@ class FpDirectOrderLine(models.Model):
|
|||||||
and rec.quantity
|
and rec.quantity
|
||||||
)
|
)
|
||||||
|
|
||||||
@api.onchange('process_variant_id')
|
@api.onchange('part_catalog_id')
|
||||||
def _onchange_recipe_clears_thickness(self):
|
def _onchange_part_default_thickness(self):
|
||||||
|
"""Auto-fill thickness range — same chain as the SO line.
|
||||||
|
|
||||||
|
1. Operator already typed → keep
|
||||||
|
2. Most recent SO line for (part, customer) with a thickness → copy
|
||||||
|
3. Part's x_fc_default_thickness_range → copy
|
||||||
|
4. Blank
|
||||||
|
"""
|
||||||
for rec in self:
|
for rec in self:
|
||||||
if (rec.thickness_id
|
if rec.thickness_range:
|
||||||
and rec.thickness_id.recipe_id != rec.process_variant_id):
|
continue
|
||||||
rec.thickness_id = False
|
if not rec.part_catalog_id:
|
||||||
|
continue
|
||||||
|
partner = rec.wizard_id.partner_id
|
||||||
|
if partner:
|
||||||
|
recent = self.env['sale.order.line'].search([
|
||||||
|
('x_fc_part_catalog_id', '=', rec.part_catalog_id.id),
|
||||||
|
('order_id.partner_id', '=', partner.id),
|
||||||
|
('x_fc_thickness_range', '!=', False),
|
||||||
|
('x_fc_thickness_range', '!=', ''),
|
||||||
|
], order='create_date desc', limit=1)
|
||||||
|
if recent:
|
||||||
|
rec.thickness_range = recent.x_fc_thickness_range
|
||||||
|
continue
|
||||||
|
part_default = getattr(
|
||||||
|
rec.part_catalog_id, 'x_fc_default_thickness_range', None,
|
||||||
|
)
|
||||||
|
if part_default:
|
||||||
|
rec.thickness_range = part_default
|
||||||
|
|
||||||
def action_generate_serial(self):
|
def action_generate_serial(self):
|
||||||
"""Generate one auto-sequenced fp.serial and append to the M2M.
|
"""Generate one auto-sequenced fp.serial and append to the M2M.
|
||||||
|
|||||||
@@ -595,7 +595,7 @@ class FpDirectOrderWizard(models.Model):
|
|||||||
if line.serial_ids else False),
|
if line.serial_ids else False),
|
||||||
'x_fc_serial_id': line.serial_id.id or False,
|
'x_fc_serial_id': line.serial_id.id or False,
|
||||||
'x_fc_job_number': line.job_number or False,
|
'x_fc_job_number': line.job_number or False,
|
||||||
'x_fc_thickness_id': line.thickness_id.id or False,
|
'x_fc_thickness_range': line.thickness_range or False,
|
||||||
# Sub 9 — explicit tax override from the wizard line.
|
# Sub 9 — explicit tax override from the wizard line.
|
||||||
# When blank, Odoo will compute taxes from the product
|
# When blank, Odoo will compute taxes from the product
|
||||||
# defaults at SO-line save time (the standard behaviour).
|
# defaults at SO-line save time (the standard behaviour).
|
||||||
@@ -633,6 +633,15 @@ class FpDirectOrderWizard(models.Model):
|
|||||||
# 6. Push-to-defaults — Specification carry-over to the part's
|
# 6. Push-to-defaults — Specification carry-over to the part's
|
||||||
# x_fc_default_customer_spec_id is handled by an inherit in
|
# x_fc_default_customer_spec_id is handled by an inherit in
|
||||||
# fusion_plating_quality (the field lives there).
|
# fusion_plating_quality (the field lives there).
|
||||||
|
# Thickness range: lives in configurator, push here.
|
||||||
|
for line in self.line_ids:
|
||||||
|
if not line.push_to_defaults or line.is_one_off:
|
||||||
|
continue
|
||||||
|
part = resolved_parts.get(line.id) or line.part_catalog_id
|
||||||
|
if not part:
|
||||||
|
continue
|
||||||
|
if line.thickness_range and not part.x_fc_default_thickness_range:
|
||||||
|
part.x_fc_default_thickness_range = line.thickness_range
|
||||||
so.message_post(body=_(
|
so.message_post(body=_(
|
||||||
'Quotation created from PO %s with %d line(s). '
|
'Quotation created from PO %s with %d line(s). '
|
||||||
'Review and confirm manually when ready.'
|
'Review and confirm manually when ready.'
|
||||||
|
|||||||
@@ -172,11 +172,8 @@
|
|||||||
string="Process Source"
|
string="Process Source"
|
||||||
readonly="1"
|
readonly="1"
|
||||||
optional="hide"/>
|
optional="hide"/>
|
||||||
<field name="thickness_id"
|
<field name="thickness_range"
|
||||||
options="{'no_quick_create': True}"
|
placeholder="e.g. 0.0005-0.0008 mils"
|
||||||
context="{'default_recipe_id': process_variant_id}"
|
|
||||||
domain="[('recipe_id', '=', process_variant_id)]"
|
|
||||||
invisible="not process_variant_id"
|
|
||||||
optional="show"/>
|
optional="show"/>
|
||||||
<field name="serial_ids"
|
<field name="serial_ids"
|
||||||
widget="many2many_tags"
|
widget="many2many_tags"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||||
{
|
{
|
||||||
'name': 'Fusion Plating — Native Jobs',
|
'name': 'Fusion Plating — Native Jobs',
|
||||||
'version': '19.0.10.1.0',
|
'version': '19.0.10.2.0',
|
||||||
'category': 'Manufacturing/Plating',
|
'category': 'Manufacturing/Plating',
|
||||||
'summary': 'Native plating job model — replaces mrp.production / mrp.workorder bridge.',
|
'summary': 'Native plating job model — replaces mrp.production / mrp.workorder bridge.',
|
||||||
'author': 'Nexa Systems Inc.',
|
'author': 'Nexa Systems Inc.',
|
||||||
|
|||||||
@@ -420,16 +420,16 @@ class SaleOrder(models.Model):
|
|||||||
'x_fc_customer_spec_id' in line._fields
|
'x_fc_customer_spec_id' in line._fields
|
||||||
and line.x_fc_customer_spec_id.id
|
and line.x_fc_customer_spec_id.id
|
||||||
) or False
|
) or False
|
||||||
thickness_id = (
|
thickness_key = (
|
||||||
'x_fc_thickness_id' in line._fields
|
'x_fc_thickness_range' in line._fields
|
||||||
and line.x_fc_thickness_id.id
|
and (line.x_fc_thickness_range or '').strip()
|
||||||
) or False
|
) or False
|
||||||
serial_id = (
|
serial_id = (
|
||||||
'x_fc_serial_id' in line._fields
|
'x_fc_serial_id' in line._fields
|
||||||
and line.x_fc_serial_id.id
|
and line.x_fc_serial_id.id
|
||||||
) or False
|
) or False
|
||||||
if recipe:
|
if recipe:
|
||||||
key = (recipe.id, part_id, spec_id, thickness_id, serial_id)
|
key = (recipe.id, part_id, spec_id, thickness_key, serial_id)
|
||||||
else:
|
else:
|
||||||
unrecipe_idx += 1
|
unrecipe_idx += 1
|
||||||
key = ('no_recipe', unrecipe_idx)
|
key = ('no_recipe', unrecipe_idx)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Fusion Plating — Logistics',
|
'name': 'Fusion Plating — Logistics',
|
||||||
'version': '19.0.3.7.0',
|
'version': '19.0.3.8.0',
|
||||||
'category': 'Manufacturing/Plating',
|
'category': 'Manufacturing/Plating',
|
||||||
'summary': (
|
'summary': (
|
||||||
'Pickup & delivery for plating shops: vehicle master, driver '
|
'Pickup & delivery for plating shops: vehicle master, driver '
|
||||||
|
|||||||
@@ -67,9 +67,9 @@ class FpDelivery(models.Model):
|
|||||||
string='Job #', index=True,
|
string='Job #', index=True,
|
||||||
help='Shop-floor job number from the MO. Prints on packing slip.',
|
help='Shop-floor job number from the MO. Prints on packing slip.',
|
||||||
)
|
)
|
||||||
x_fc_thickness_id = fields.Many2one(
|
x_fc_thickness_range = fields.Char(
|
||||||
'fp.recipe.thickness', string='Thickness',
|
string='Thickness',
|
||||||
ondelete='set null',
|
help='Carried from the SO line — prints on packing slip / BoL.',
|
||||||
)
|
)
|
||||||
x_fc_revision_snapshot = fields.Char(
|
x_fc_revision_snapshot = fields.Char(
|
||||||
string='Revision (snapshot)',
|
string='Revision (snapshot)',
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
# License OPL-1 (Odoo Proprietary License v1.0)
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
||||||
{
|
{
|
||||||
'name': 'Fusion Plating — Reports',
|
'name': 'Fusion Plating — Reports',
|
||||||
'version': '19.0.11.0.0',
|
'version': '19.0.11.1.0',
|
||||||
'category': 'Manufacturing/Plating',
|
'category': 'Manufacturing/Plating',
|
||||||
'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.',
|
'summary': 'PDF reports for Fusion Plating: quote, SO, WO, packing, BoL, CoC, invoice, receipt, quality + compliance.',
|
||||||
'depends': [
|
'depends': [
|
||||||
|
|||||||
@@ -94,9 +94,9 @@
|
|||||||
<br/>
|
<br/>
|
||||||
<small>Serial: <span t-esc="line.x_fc_serial_id.name"/></small>
|
<small>Serial: <span t-esc="line.x_fc_serial_id.name"/></small>
|
||||||
</t>
|
</t>
|
||||||
<t t-if="'x_fc_thickness_id' in line._fields and line.x_fc_thickness_id">
|
<t t-if="'x_fc_thickness_range' in line._fields and line.x_fc_thickness_range">
|
||||||
<br/>
|
<br/>
|
||||||
<small>Thickness: <span t-esc="line.x_fc_thickness_id.display_name"/></small>
|
<small>Thickness: <span t-esc="line.x_fc_thickness_range"/></small>
|
||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
<t t-else="">
|
<t t-else="">
|
||||||
|
|||||||
@@ -87,14 +87,11 @@
|
|||||||
<!-- Serial number — Sub 5 added x_fc_serial_id (M2O fp.serial) on
|
<!-- Serial number — Sub 5 added x_fc_serial_id (M2O fp.serial) on
|
||||||
the SO line. The serial record's `name` is the printable label. -->
|
the SO line. The serial record's `name` is the printable label. -->
|
||||||
<t t-set="_serial_number" t-value="(_line and 'x_fc_serial_id' in _line._fields and _line.x_fc_serial_id and _line.x_fc_serial_id.name) or '-'"/>
|
<t t-set="_serial_number" t-value="(_line and 'x_fc_serial_id' in _line._fields and _line.x_fc_serial_id and _line.x_fc_serial_id.name) or '-'"/>
|
||||||
<!-- Thickness — Sub 5 added x_fc_thickness_id (M2O fp.coating.thickness)
|
<!-- Thickness — operator-typed Char range, e.g. "0.0005-0.0008 mils".
|
||||||
on the SO line. `display_name` is the human-readable range, e.g.
|
Stored as-typed; ASCII-safe by convention. Strip en/em-dash
|
||||||
"0.3–0.5 mils". The en-dash (U+2013) in display_name mojibakes
|
defensively for the wkhtmltopdf font path on entech. -->
|
||||||
to "â€"" through wkhtmltopdf's font path on entech, so we
|
<t t-set="_thickness_raw" t-value="_line and 'x_fc_thickness_range' in _line._fields and _line.x_fc_thickness_range"/>
|
||||||
swap en-dash + em-dash for a plain hyphen-minus before
|
<t t-set="_thickness" t-value="(_thickness_raw and _thickness_raw.replace(u'–', '-').replace(u'—', '-')) or '-'"/>
|
||||||
rendering. ASCII-only printable for any QR-label printer. -->
|
|
||||||
<t t-set="_thickness_dn" t-value="_line and 'x_fc_thickness_id' in _line._fields and _line.x_fc_thickness_id and _line.x_fc_thickness_id.display_name"/>
|
|
||||||
<t t-set="_thickness" t-value="(_thickness_dn and _thickness_dn.replace(u'–', '-').replace(u'—', '-')) or '-'"/>
|
|
||||||
<!-- Notes content — outer can pre-set this (e.g. the Internal
|
<!-- Notes content — outer can pre-set this (e.g. the Internal
|
||||||
variant passes line.x_fc_internal_description). Otherwise
|
variant passes line.x_fc_internal_description). Otherwise
|
||||||
falls back to line.name (customer-facing description per
|
falls back to line.name (customer-facing description per
|
||||||
|
|||||||
Reference in New Issue
Block a user