def isOpen(self): """ Returns true if the Batch is in 'open' state """ revstatus = getCurrentState(self, StateFlow.review) canstatus = getCurrentState(self, StateFlow.cancellation) return revstatus == BatchState.open \ and canstatus == CancellationState.active
def workflow_guard_close(self): """ Permitted if current review_state is 'open'. The close transition is already controlled by 'Bika: Close Batch' permission, but left here for security reasons and also for the capability of being expanded/overrided by child products or instance-specific needs. """ revstatus = getCurrentState(self, StateFlow.review) canstatus = getCurrentState(self, StateFlow.cancellation) return revstatus == BatchState.open \ and canstatus == CancellationState.active
def getContacts(self, only_active=True): """ Return an array containing the contacts from this Client """ contacts = [] if only_active: contacts = [c for c in self.objectValues('Contact') if getCurrentState(c, StateFlow.inactive) == InactiveState.active] else: contacts = self.objectValues('Contact') return contacts;