Code Duplication    Length = 12-12 lines in 2 locations

bika/lims/content/method.py 1 location

@@ 149-160 (lines=12) @@
146
        """
147
        return len(self.getInstruments()) == 0 or self.getManualEntryOfResults()
148
149
    def _getCalculations(self):
150
        """ Returns a DisplayList with the available Calculations
151
            registered in Bika-Setup. Used to fill the Calculation
152
            ReferenceWidget.
153
        """
154
        bsc = getToolByName(self, 'bika_setup_catalog')
155
        items = [(c.UID, c.Title) \
156
                for c in bsc(portal_type='Calculation',
157
                             inactive_state = 'active')]
158
        items.sort(lambda x,y: cmp(x[1], y[1]))
159
        items.insert(0, ('', t(_('None'))))
160
        return DisplayList(items)
161
162
    def getInstruments(self):
163
        """ Instruments capable to perform this method

bika/lims/content/instrument.py 1 location

@@ 432-443 (lines=12) @@
429
        items.sort(lambda x, y: cmp(x[1], y[1]))
430
        return DisplayList(items)
431
432
    def _getAvailableMethods(self):
433
        """ Returns the available (active) methods.
434
            One method can be done by multiple instruments, but one
435
            instrument can only be used in one method.
436
        """
437
        bsc = getToolByName(self, 'bika_setup_catalog')
438
        items = [(c.UID, c.Title)
439
                 for c in bsc(portal_type='Method',
440
                              inactive_state='active')]
441
        items.sort(lambda x, y: cmp(x[1], y[1]))
442
        items.insert(0, ('', t(_('None'))))
443
        return DisplayList(items)
444
445
    def getInstrumentTypes(self):
446
        bsc = getToolByName(self, 'bika_setup_catalog')