From a0644a7e5c0e465cda7e23de8967533d53c5529a Mon Sep 17 00:00:00 2001 From: gsinghpal Date: Tue, 12 May 2026 00:55:03 -0400 Subject: [PATCH] fix(jobs): Finish & Next bulk-moves all parts, no more "click N times" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User feedback: operators with small parts (e.g. valve bodies) batch them through the whole recipe. The previous behavior — Finish & Next raising "use Complete 1 → Next or Move..." when qty>1 — forced N clicks for a workflow that's naturally one click. Change: _fp_record_one_piece_auto_move now ALWAYS bulk-moves qty_at_step parts to the next step in one move record, regardless of whether the qty is seed-only (first / paperwork step) or real (parked from an upstream move). Audit trail is preserved (one move row per finish), operator gets one click. Three buttons now map cleanly to the three workflows: - Finish & Next: bulk all parts forward, finish, auto-start next - Complete 1 -> Next: streaming flow, move 1 part, stay open - Move...: explicit qty + destination wizard for partial batches Verified end-to-end on entech: seed qty=6 + real-incoming qty=6 both move forward in a single click each. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../fusion_plating_jobs/__manifest__.py | 2 +- .../fusion_plating_jobs/models/fp_job_step.py | 36 ++++++------------- 2 files changed, 11 insertions(+), 27 deletions(-) diff --git a/fusion_plating/fusion_plating_jobs/__manifest__.py b/fusion_plating/fusion_plating_jobs/__manifest__.py index 9119b765..d6fffc88 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.6', + 'version': '19.0.8.20.7', '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_step.py b/fusion_plating/fusion_plating_jobs/models/fp_job_step.py index d60cbc57..ac78eb7a 100644 --- a/fusion_plating/fusion_plating_jobs/models/fp_job_step.py +++ b/fusion_plating/fusion_plating_jobs/models/fp_job_step.py @@ -1135,37 +1135,21 @@ class FpJobStep(models.Model): ).sorted('sequence')[:1] if not next_step: return False - # Seed-only qty: no real incoming moves backing it. Paperwork - # step or first-step seed — bulk-move all parts in one shot. - has_real_incoming = bool( - self.incoming_move_ids.filtered( - lambda m: m.from_step_id != self - ) - ) - if not has_real_incoming: - self.env['fp.job.step.move'].create({ - 'job_id': self.job_id.id, - 'from_step_id': self.id, - 'to_step_id': next_step.id, - 'transfer_type': 'step', - 'qty_moved': qty, - 'moved_by_user_id': self.env.user.id, - }) - return True - if qty > 1: - raise UserError(_( - "Step '%s' still has %d parts here — use the row's " - "'Complete 1 → Next' button (for one-by-one flow) " - "or the 'Move…' wizard (for batched flow) to drain " - "the step before finishing." - ) % (self.name, qty)) - # qty == 1 + real incoming → record single move. + # Bulk-move all parts in one shot. Covers three use cases: + # - seed-only qty (paperwork / first step): creates the + # first explicit move record for the batch + # - real incoming, qty == 1 (streaming flow last part): + # same as Complete 1 → Next's tail call + # - real incoming, qty > 1 (batched flow): one click moves + # everything forward — operators with small parts don't + # have to click Complete 1 → Next repeatedly + # Complete 1 → Next is still available for one-by-one flow. self.env['fp.job.step.move'].create({ 'job_id': self.job_id.id, 'from_step_id': self.id, 'to_step_id': next_step.id, 'transfer_type': 'step', - 'qty_moved': 1, + 'qty_moved': qty, 'moved_by_user_id': self.env.user.id, }) return True