| Total Complexity | 3 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |