Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List of Analyses Services is not properly filtered by state #516

Merged
merged 7 commits into from
Dec 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 18 additions & 0 deletions bika/lims/browser/bika_listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions bika/lims/browser/js/bika.lims.bikalisting.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@
rows = $('<table>' + data + '</table>').find('tr');
$('[form_id=\'' + form_id + '\'] tr[data-ajax_category=\'' + cat_title + '\']').replaceWith(rows);
$(element).removeClass('collapsed').addClass('expanded');
load_transitions();
def.resolve();
});
} else {
Expand Down
1 change: 1 addition & 0 deletions bika/lims/browser/js/coffee/bika.lims.bikalisting.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ window.BikaListingTableView = ->
$('[form_id=\'' + form_id + '\'] tr[data-ajax_category=\'' + cat_title + '\']').replaceWith rows
$(element).removeClass('collapsed').addClass 'expanded'
def.resolve()
load_transitions()
return
else
# When ajax_categories are disabled, all cat items exist as TR elements:
Expand Down
3 changes: 1 addition & 2 deletions bika/lims/controlpanel/bika_analysisservices.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ def __init__(self, context, request):
self.icon = self.portal_url + \
"/++resource++bika.lims.images/analysisservice_big.png"
self.title = self.context.translate(_("Analysis Services"))
self.form_id = "list_analysisservices"
self.show_sort_column = False
self.show_select_row = False
self.show_select_column = True
Expand Down Expand Up @@ -236,7 +237,6 @@ def __init__(self, context, request):
{'id': 'default',
'title': _('Active'),
'contentFilter': {'inactive_state': 'active'},
'transitions': [{'id': 'deactivate'}, ],
'columns': ['Title',
'Category',
'Keyword',
Expand All @@ -258,7 +258,6 @@ def __init__(self, context, request):
{'id': 'inactive',
'title': _('Dormant'),
'contentFilter': {'inactive_state': 'inactive'},
'transitions': [{'id': 'activate'}, ],
'columns': ['Title',
'Category',
'Keyword',
Expand Down