Files
Odoo-Modules/fusion_plating/fusion_plating_jobs/models/fp_job.py
gsinghpal 4c68327b9c feat(jobs): add fp.job.node.override for per-job opt-in/out decisions
Mirror of fusion.plating.job.node.override from bridge_mrp, but
bound to fp.job. bridge_mrp's version stays alive for legacy MO
flow during the migration. Both coexist.

Adds override_ids One2many to fp.job via _inherit, plus
unique(job_id, node_id) constraint.

Note: spec-suggested _sql_constraints syntax is deprecated in
Odoo 19 ("Model attribute '_sql_constraints' is no longer
supported, please define model.Constraint on the model"). Used
the new class-attribute form: _unique_job_node = models.Constraint(...).
Verified the UNIQUE index is created on the table.

3 new tests: create, uniqueness, one2many backref.

Manifest 19.0.1.1.1 -> 19.0.1.2.0.

Part of: native job model migration (spec 2026-04-25)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-24 23:12:53 -04:00

44 lines
1.2 KiB
Python

# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
#
# fp.job extension — cross-module fields that couldn't live in core
# because their target models are in dependent modules. Per spec §5.1
# this module is the umbrella that re-bundles the cross-module
# extensions for the native job flow.
#
# qc_check_id is deferred to Task 2.7 (the underlying QC model still
# lives in fusion_plating_bridge_mrp; we'll address its sourcing then).
from odoo import fields, models
class FpJob(models.Model):
_inherit = 'fp.job'
part_catalog_id = fields.Many2one(
'fp.part.catalog',
string='Part',
)
coating_config_id = fields.Many2one(
'fp.coating.config',
string='Coating Configuration',
)
customer_spec_id = fields.Many2one(
'fusion.plating.customer.spec',
string='Customer Spec',
)
portal_job_id = fields.Many2one(
'fusion.plating.portal.job',
string='Portal Job',
)
delivery_id = fields.Many2one(
'fusion.plating.delivery',
string='Delivery',
)
override_ids = fields.One2many(
'fp.job.node.override',
'job_id',
string='Recipe Overrides',
)