Skip to content

Commit

Permalink
Integrate transition chain shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonski committed Nov 15, 2024
1 parent d5b1338 commit 429959a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/bika/lims/workflow/analysis/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,17 @@
from bika.lims.workflow.analysis import STATE_REJECTED
from bika.lims.workflow.analysis import STATE_RETRACTED
from DateTime import DateTime
from zope.annotation.interfaces import IAnnotations
from zope.interface import Interface
from zope.interface import alsoProvides

try:
# https://github.com/senaite/senaite.app.listing/pull/146
from senaite.app.listing.interfaces import ITransitionChain
except ImportError:
class ITransitionChain(Interface):
pass


def after_assign(analysis):
"""Function triggered after an 'assign' transition for the analysis passed
Expand Down Expand Up @@ -253,6 +262,16 @@ def check_all_verified(analysis):
:param analysis: The current verified analysis
:returns: True if all other routine analyses of the sample are verified
"""

request = api.get_request()
if ITransitionChain.providedBy(request):
transition_chain = IAnnotations(request).get("transition_chain")
if api.is_list(transition_chain) and len(transition_chain) > 0:
# check if the current processed UID is the last
uid = api.get_uid(analysis)
# skip further processing if the current UID is not the last
return uid == transition_chain[-1]

parent = api.get_parent(analysis)
sample = analysis.getRequest()
uid = api.get_uid(analysis)
Expand Down

0 comments on commit 429959a

Please sign in to comment.