Skip to content
This repository was archived by the owner on Jan 16, 2024. It is now read-only.

Commit e5e7ee7

Browse files
authored
All Samples are listed inside Case context (#103)
* Link to Add Case inside client context is wrong Should redirect to the base /batches folder. Otherwise, the case is created inside the Client. * Update changes.rst
1 parent b7c861d commit e5e7ee7

File tree

2 files changed

+8
-18
lines changed

2 files changed

+8
-18
lines changed

CHANGES.rst

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Changelog
1818

1919
**Fixed**
2020

21+
- #102 All Samples are listed inside Case context
2122
- #99 Traceback when publishing health results from inside a client
2223
- #97 Traceback accessing Doctor samples when user is not Manager, LabManager or LabClerk
2324
- #82 Inconsistent behavior with health' skins priority over core's

bika/health/browser/batch/samples.py

+7-18
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,17 @@
55
# Copyright 2018 by it's authors.
66
# Some rights reserved. See LICENSE.rst, CONTRIBUTORS.rst.
77

8-
from Products.CMFCore.utils import getToolByName
8+
from bika.lims import api
99
from bika.health.browser.samples.folder_view import SamplesView
1010

1111

1212
class BatchSamplesView(SamplesView):
13+
1314
def __init__(self, context, request):
1415
super(BatchSamplesView, self).__init__(context, request)
1516
self.view_url = self.context.absolute_url() + "/samples"
16-
if 'path' in self.contentFilter:
17-
del(self.contentFilter['path'])
18-
19-
def contentsMethod(self, contentFilter):
20-
tool = getToolByName(self.context, self.catalog)
21-
state = [x for x in self.review_states if x['id'] == self.review_state['id']][0]
22-
for k, v in state['contentFilter'].items():
23-
self.contentFilter[k] = v
24-
tool_samples = tool(contentFilter)
25-
samples = {}
26-
for sample in (p.getObject() for p in tool_samples):
27-
for ar in sample.getAnalysisRequests():
28-
batch = ar.getBatch()
29-
batch_uid = batch.UID() if batch else ''
30-
if batch_uid == self.context.UID():
31-
samples[sample.getId()] = sample
32-
return samples.values()
17+
self.contentFilter = {'portal_type': 'Sample',
18+
'getBatchUIDs': api.get_uid(self.context),
19+
'sort_on': 'created',
20+
'sort_order': 'reverse',
21+
'cancellation_state':'active'}

0 commit comments

Comments
 (0)