feat(plating): Sub 5 — order-line fields (serial, job#, thickness, revision)

Four new fields on every sale.order.line, propagated through to MO,
Delivery, and Invoice for end-to-end traceability:

- fp.serial registry (new model in configurator) with smart-button
  traceability to Sale Order, MO, Delivery, Invoice, Part. M2O on SO
  line; optional; user types a customer serial or clicks Generate
  Serial for a sequence-backed one. Reverse O2M links split across
  configurator (invoice) / bridge_mrp (MO) / logistics (delivery) so
  module load order is respected.
- x_fc_job_number on SO line, auto-sequenced FP-JOB-NNNNN on SO
  confirm. Editable — shops can override for customer/legacy schemes.
- fp.coating.thickness (new child of fp.coating.config) with per-
  config discrete thickness options; x_fc_thickness_id on SO line
  domain-filtered to the line's coating. Auto-clears when coating
  changes.
- x_fc_revision_snapshot Char on SO line, frozen from
  x_fc_part_catalog_id.revision at save. Protects historical SOs from
  later catalog edits. Secondary "Revision" picker on the tree view
  lets users switch between prior revisions of the same part number;
  the Part M2O still surfaces only is_latest_revision rows.

Reports (CoC, packing slip, invoice, BoL) pick up all four via the
Sub 2 customer_line_header macro — one macro edit, four reports.

Smoke on entech: 11 assertions pass including revision snapshot,
generate-serial button, typed-serial create-on-fly, coating→thickness
domain reset, SO confirm auto job#, and MO traceability carry.

Module version bumps:
  fusion_plating_configurator  → 19.0.12.0.0
  fusion_plating_bridge_mrp    → 19.0.11.0.0
  fusion_plating_logistics     → 19.0.2.0.0 (+depends configurator)
  fusion_plating_reports       → 19.0.5.1.0

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsinghpal
2026-04-22 23:04:44 -04:00
parent bb9bcf45f8
commit 25c3f6f8d1
29 changed files with 934 additions and 21 deletions

View File

@@ -5,7 +5,7 @@
{
'name': 'Fusion Plating — Logistics',
'version': '19.0.1.2.0',
'version': '19.0.2.0.0',
'category': 'Manufacturing/Plating',
'summary': (
'Pickup & delivery for plating shops: vehicle master, driver '
@@ -41,6 +41,7 @@ Copyright (c) 2026 Nexa Systems Inc. All rights reserved.
'currency': 'CAD',
'depends': [
'fusion_plating',
'fusion_plating_configurator',
'hr',
'mail',
],

View File

@@ -11,3 +11,4 @@ from . import fp_route
from . import fp_route_stop
from . import fp_chain_of_custody
from . import fp_proof_of_delivery
from . import fp_serial

View File

@@ -57,6 +57,23 @@ class FpDelivery(models.Model):
'Will become a Many2one once the job module ships.',
tracking=True,
)
# ---- Sub 5 — traceability fields from the source MO --------------------
x_fc_serial_id = fields.Many2one(
'fp.serial', string='Serial Number',
ondelete='set null', index=True,
help='Serial copied from the MO when bridge_mrp drafts this delivery.',
)
x_fc_job_number = fields.Char(
string='Job #', index=True,
help='Shop-floor job number from the MO. Prints on packing slip.',
)
x_fc_thickness_id = fields.Many2one(
'fp.coating.thickness', string='Thickness',
ondelete='set null',
)
x_fc_revision_snapshot = fields.Char(
string='Revision (snapshot)',
)
scheduled_date = fields.Datetime(
string='Scheduled Date',
tracking=True,

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
# Part of the Fusion Plating product family.
#
# Sub 5 — attach delivery reverse link to fp.serial. Lives here rather
# than in fusion_plating_configurator because fusion.plating.delivery
# is defined in this module, which loads after configurator.
from odoo import api, fields, models
class FpSerial(models.Model):
_inherit = 'fp.serial'
delivery_ids = fields.One2many(
'fusion.plating.delivery', 'x_fc_serial_id',
string='Deliveries',
)
delivery_count = fields.Integer(compute='_compute_delivery_count')
@api.depends('delivery_ids')
def _compute_delivery_count(self):
for rec in self:
rec.delivery_count = len(rec.delivery_ids)