fix(jobs): header Finish & Next propagates button_start's action
Bug: action_finish_current_step (the header-level Finish & Next
button on the job form) called button_start() without capturing its
return value. So when button_start returned an action (e.g. the new
QA-005 redirect for contract_review steps from 21e42e7), the header
method threw it away and returned True. Result: operator clicked
Finish & Next, the step started, but no navigation. They had to
click again — the second click found the in_progress step, called
action_finish_and_advance, which returned the QA-005 action.
Two clicks instead of one to land on QA-005.
Fix: capture button_start's return value. If it's a dict (= an
action), return it. Otherwise return True (the normal case).
User reproduction (WH/JOB/00341):
Header > Finish & Next (1st click) → step starts + QA-005 opens
Sign / dismiss QA-005 → back to job
Header > Finish & Next (2nd click) → step finishes + next starts
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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.8.17.1',
|
'version': '19.0.8.17.2',
|
||||||
'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.',
|
||||||
|
|||||||
@@ -263,6 +263,11 @@ class FpJob(models.Model):
|
|||||||
nothing is running yet, start the lowest-sequence pending step
|
nothing is running yet, start the lowest-sequence pending step
|
||||||
instead — operator's first click on a fresh job just begins
|
instead — operator's first click on a fresh job just begins
|
||||||
the line.
|
the line.
|
||||||
|
|
||||||
|
Sub 12e v4 — when button_start returns an action (e.g. the
|
||||||
|
QA-005 redirect for contract_review steps), propagate it so
|
||||||
|
the operator lands on the right page in ONE click instead of
|
||||||
|
two.
|
||||||
"""
|
"""
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
running = self.step_ids.filtered(lambda s: s.state == 'in_progress')[:1]
|
running = self.step_ids.filtered(lambda s: s.state == 'in_progress')[:1]
|
||||||
@@ -277,10 +282,17 @@ class FpJob(models.Model):
|
|||||||
'No runnable step found on this job — either every step '
|
'No runnable step found on this job — either every step '
|
||||||
'is done or the job is still in draft.'
|
'is done or the job is still in draft.'
|
||||||
))
|
))
|
||||||
first.with_context(fp_skip_predecessor_check=True).button_start()
|
result = first.with_context(
|
||||||
|
fp_skip_predecessor_check=True,
|
||||||
|
).button_start()
|
||||||
self.message_post(body=_(
|
self.message_post(body=_(
|
||||||
'Started first step "%s".'
|
'Started first step "%s".'
|
||||||
) % first.name)
|
) % first.name)
|
||||||
|
# Propagate any action returned by button_start (e.g. the
|
||||||
|
# QA-005 redirect on a contract_review step). If it's just
|
||||||
|
# True/False (the normal case), fall back to True.
|
||||||
|
if isinstance(result, dict):
|
||||||
|
return result
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def action_open_move_wizard(self):
|
def action_open_move_wizard(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user