Files
Odoo-Modules/fusion_plating/fusion_plating_jobs/models/res_config_settings.py
gsinghpal 294cea0e50 feat(jobs): add x_fc_use_native_jobs flag + SO confirm hook (Task 2.5)
Settings flag controls which SO confirm path runs. Default False
keeps the legacy bridge_mrp / mrp.production flow on entech.
Setting True diverts confirm into fp.job creation.

Both hooks coexist — bridge_mrp's _fp_auto_create_mo and the new
_fp_auto_create_job — but only one creates records per SO confirm
(controlled by the flag).

The new _fp_auto_create_job mirrors bridge_mrp's grouping logic
(x_fc_wo_group_tag), recipe resolution (coating → part), and
traceability fields (origin, sale_order_line_ids).

Settings UI shows the flag in a 'Fusion Plating Jobs' app section
of the standard Configuration menu.

3 new tests cover: flag off no-op, flag on creates job, idempotency.

Manifest 19.0.1.3.0 → 19.0.1.4.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:22:41 -04:00

24 lines
811 B
Python

# -*- coding: utf-8 -*-
# Copyright 2026 Nexa Systems Inc.
# License OPL-1 (Odoo Proprietary License v1.0)
#
# x_fc_use_native_jobs — company-level setting that controls whether
# SO confirmation creates a native fp.job record (this module) or
# the legacy mrp.production / mrp.workorder records (bridge_mrp).
#
# Default: False (legacy MO flow). Phase 9 cutover flips this to True
# on entech.
from odoo import fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
x_fc_use_native_jobs = fields.Boolean(
string='Use Native Plating Jobs',
config_parameter='fusion_plating_jobs.use_native_jobs',
help='When enabled, SO confirmation creates fp.job records '
'instead of mrp.production. Phase-2 migration toggle.',
)