diff --git a/CHANGES.rst b/CHANGES.rst index 97e7018445..115c151806 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -15,6 +15,8 @@ Changelog **Fixed** +- #516 List of Analyses Services is not properly filtered by state +- #516 Activate and Deactivate buttons do not appear in Analysis Services list - #512 Duplicates transition to "Attachment due" after submit - #499 Wrong slots when adding analyses manually in Worksheet with a WST assigned - #499 When a Worksheet Template is used, slot positions are not applied correctly diff --git a/bika/lims/browser/bika_listing.py b/bika/lims/browser/bika_listing.py index 7d4769cd7c..7d15f6352c 100644 --- a/bika/lims/browser/bika_listing.py +++ b/bika/lims/browser/bika_listing.py @@ -1388,6 +1388,24 @@ def rendered_items(self): self.cat = self.request.get('ajax_category_expand') self.contentFilter[self.category_index] = self.request.get('cat') + # Filter items by state. First remove them from contentFilter + # and then, look for its value from the request + clear_states = ['inactive_state', 'review_state', 'cancellation_state'] + for clear_state in clear_states: + if clear_state in self.contentFilter: + del self.contentFilter[clear_state] + req_revstate = self.request.get('review_state', None) + if req_revstate: + for revstate in self.review_states: + if revstate.get('id', None) != req_revstate: + continue + rev_cfilter = revstate.get('contentFilter', {}) + if not rev_cfilter: + continue + for key, value in rev_cfilter.items(): + self.contentFilter[key] = value + break + # These are required to allow the template to work with this class as # the view. Normally these are attributes of class BikaListingTable. self.bika_listing = self diff --git a/bika/lims/browser/js/bika.lims.bikalisting.js b/bika/lims/browser/js/bika.lims.bikalisting.js index ed7c1b5720..2d7fc2527f 100644 --- a/bika/lims/browser/js/bika.lims.bikalisting.js +++ b/bika/lims/browser/js/bika.lims.bikalisting.js @@ -639,6 +639,7 @@ rows = $('