feat(fusion_plating): cert backfill migration + version bumps
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
'name': 'Fusion Plating — Certificates',
|
'name': 'Fusion Plating — Certificates',
|
||||||
'version': '19.0.9.3.0',
|
'version': '19.0.10.0.0',
|
||||||
'category': 'Manufacturing/Plating',
|
'category': 'Manufacturing/Plating',
|
||||||
'summary': 'Certificate registry for CoC, thickness reports, and quality documents.',
|
'summary': 'Certificate registry for CoC, thickness reports, and quality documents.',
|
||||||
'description': """
|
'description': """
|
||||||
|
|||||||
@@ -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.12.1.6',
|
'version': '19.0.12.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.',
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Backfill one fp.certificate.part per existing certificate from its
|
||||||
|
# legacy singular fields, so pre-existing certs render identically under
|
||||||
|
# the new multi-part CoC. Lives in fusion_plating_jobs (not certificates)
|
||||||
|
# because it reads x_fc_job_id, a jobs-module field; the part-line table
|
||||||
|
# itself is created by the certificates upgrade, which runs first.
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from odoo import api, SUPERUSER_ID
|
||||||
|
|
||||||
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
def migrate(cr, version):
|
||||||
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||||
|
if 'fp.certificate.part' not in env:
|
||||||
|
return
|
||||||
|
certs = env['fp.certificate'].search([])
|
||||||
|
made = 0
|
||||||
|
for cert in certs:
|
||||||
|
if cert.part_line_ids:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
pid = cert._fp_resolve_part_identity() # (number, name, serials)
|
||||||
|
except Exception:
|
||||||
|
pid = ('', '', '')
|
||||||
|
job = cert.x_fc_job_id if 'x_fc_job_id' in cert._fields else False
|
||||||
|
part = job.part_catalog_id if (job and 'part_catalog_id' in job._fields) else False
|
||||||
|
try:
|
||||||
|
desc = cert._fp_resolve_customer_facing_description() or cert.process_description or ''
|
||||||
|
except Exception:
|
||||||
|
desc = cert.process_description or ''
|
||||||
|
spec = cert.customer_spec_id if 'customer_spec_id' in cert._fields else False
|
||||||
|
env['fp.certificate.part'].create({
|
||||||
|
'certificate_id': cert.id, 'sequence': 10,
|
||||||
|
'part_catalog_id': part.id if part else False,
|
||||||
|
'part_number': cert.part_number or (pid[0] or ''),
|
||||||
|
'part_name': pid[1] or '',
|
||||||
|
'description': desc,
|
||||||
|
'serial': pid[2] or '',
|
||||||
|
'customer_spec_id': spec.id if spec else False,
|
||||||
|
'spec_reference': cert.spec_reference or '',
|
||||||
|
'quantity_shipped': cert.quantity_shipped or 0,
|
||||||
|
'nc_quantity': cert.nc_quantity or 0,
|
||||||
|
})
|
||||||
|
made += 1
|
||||||
|
_logger.info('fp.certificate.part backfill: created %s part-line(s)', made)
|
||||||
@@ -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.34.0',
|
'version': '19.0.11.35.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': [
|
||||||
|
|||||||
Reference in New Issue
Block a user