Passed
Push — master ( ac8f85...f8b67c )
by Ramon
05:19
created

bika.lims.catalog.indexers.cancellation_state()   A

Complexity

Conditions 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 8
rs 10
c 0
b 0
f 0
cc 2
nop 1
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 api
9
from bika.lims.interfaces import ICancellable
10
from plone.indexer import indexer
11
12
@indexer(ICancellable)
13
def cancellation_state(instance):
14
    """Acts as a mask for cancellation_workflow for those content types that are
15
    not bound to this workflow. Returns 'active' or 'cancelled'
16
    """
17
    if api.get_workflow_status_of(instance) == "cancelled":
18
        return "cancelled"
19
    return "active"
20