Passed
Push — master ( 6f481d...90957c )
by Ramon
05:08
created

bika.lims.workflow.worksheet.events   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 7
dl 0
loc 30
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A after_submit() 0 12 1
A after_retract() 0 5 2
1
# -*- coding: utf-8 -*-
2
#
3
# This file is part of SENAITE.CORE
4
#
5
# Copyright 2018 by it's authors.
6
# Some rights reserved. See LICENSE.rst, CONTRIBUTORS.rst.
7
8
from bika.lims import workflow as wf
9
10
11
def after_submit(obj):
12
    """
13
    Method triggered after a 'submit' transition for the Worksheet passed in is
14
    performed.
15
    This function is called automatically by
16
    bika.lims.workfow.AfterTransitionEventHandler
17
    """
18
    # Submitting a Worksheet must never transition the analyses.
19
    # In fact, a worksheet can only be transitioned to "to_be_verified" if
20
    # all the analyses that contain have been submitted manually after
21
    # the results input
22
    wf.doActionFor(obj, 'attach')
23
24
25
def after_retract(worksheet):
26
    """Retracts all analyses the worksheet contains
27
    """
28
    for analysis in worksheet.getAnalyses():
29
       wf.doActionFor(analysis, "retract")
30