diff --git a/fusion_plating/fusion_plating_jobs/__manifest__.py b/fusion_plating/fusion_plating_jobs/__manifest__.py index 1c0fb325..fed43300 100644 --- a/fusion_plating/fusion_plating_jobs/__manifest__.py +++ b/fusion_plating/fusion_plating_jobs/__manifest__.py @@ -3,7 +3,7 @@ # License OPL-1 (Odoo Proprietary License v1.0) { 'name': 'Fusion Plating — Native Jobs', - 'version': '19.0.8.20.4', + 'version': '19.0.8.20.5', 'category': 'Manufacturing/Plating', 'summary': 'Native plating job model — replaces mrp.production / mrp.workorder bridge.', 'author': 'Nexa Systems Inc.', diff --git a/fusion_plating/fusion_plating_jobs/models/fp_job.py b/fusion_plating/fusion_plating_jobs/models/fp_job.py index 6647cdd9..de74b609 100644 --- a/fusion_plating/fusion_plating_jobs/models/fp_job.py +++ b/fusion_plating/fusion_plating_jobs/models/fp_job.py @@ -108,6 +108,8 @@ class FpJob(models.Model): 'quality_hold_count', 'delivery_id', 'delivery_id.state', + 'sale_order_id', + 'sale_order_id.x_fc_receiving_status', ) def _compute_workflow_state_id(self): WS = self.env['fp.job.workflow.state'] diff --git a/fusion_plating/fusion_plating_jobs/models/fp_job_workflow_state.py b/fusion_plating/fusion_plating_jobs/models/fp_job_workflow_state.py index e9e73133..424cb6bb 100644 --- a/fusion_plating/fusion_plating_jobs/models/fp_job_workflow_state.py +++ b/fusion_plating/fusion_plating_jobs/models/fp_job_workflow_state.py @@ -157,6 +157,20 @@ class FpJobWorkflowState(models.Model): 'safety-net for Done ("done").', ) + trigger_on_parts_received = fields.Boolean( + string='Trigger on Parts Received', + default=False, + help='Special trigger — passes once the job\'s sale order has ' + 'a receiving status of "partial" or "received" (set by ' + 'the fp.receiving inbound logistics flow). Used by the ' + 'Received milestone in lieu of recipe-side ' + 'default_kind="receiving" tagging. Receiving is a pre-' + 'recipe activity (parts physically arrive on the dock) — ' + 'keeping the trigger off recipe steps means shops without ' + 'a "Receiving" step in their recipe still see the bar ' + 'advance correctly.', + ) + block_when_quality_hold = fields.Boolean( string='Blocked by Quality Hold', default=False, @@ -214,6 +228,15 @@ class FpJobWorkflowState(models.Model): job.delivery_id and job.delivery_id.state == 'delivered' ) + # Special trigger: parts physically received (pre-recipe). + if self.trigger_on_parts_received: + so = job.sale_order_id + if (so and 'x_fc_receiving_status' in so._fields + and so.x_fc_receiving_status + in ('partial', 'received')): + return True + return False + # Special trigger: job.state reached ("at least" semantics). if self.trigger_on_job_state: order = {