|
1
|
|
|
# -*- coding: utf-8 -*- |
|
2
|
|
|
# |
|
3
|
|
|
# This file is part of SENAITE.CORE. |
|
4
|
|
|
# |
|
5
|
|
|
# SENAITE.CORE is free software: you can redistribute it and/or modify it under |
|
6
|
|
|
# the terms of the GNU General Public License as published by the Free Software |
|
7
|
|
|
# Foundation, version 2. |
|
8
|
|
|
# |
|
9
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT |
|
10
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
11
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
|
12
|
|
|
# details. |
|
13
|
|
|
# |
|
14
|
|
|
# You should have received a copy of the GNU General Public License along with |
|
15
|
|
|
# this program; if not, write to the Free Software Foundation, Inc., 51 |
|
16
|
|
|
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
|
17
|
|
|
# |
|
18
|
|
|
# Copyright 2018-2020 by it's authors. |
|
19
|
|
|
# Some rights reserved, see README and LICENSE. |
|
20
|
|
|
|
|
21
|
|
|
from bika.lims import api |
|
22
|
|
|
from bika.lims.browser.publish.reports_listing import ReportsListingView |
|
23
|
|
|
|
|
24
|
|
|
|
|
25
|
|
|
class AnalysisRequestPublishedResults(ReportsListingView): |
|
26
|
|
|
"""View of published results |
|
27
|
|
|
""" |
|
28
|
|
|
|
|
29
|
|
|
def __init__(self, context, request): |
|
30
|
|
|
super(AnalysisRequestPublishedResults, self).__init__(context, request) |
|
31
|
|
|
|
|
32
|
|
|
# get the client for the catalog query |
|
33
|
|
|
client = context.getClient() |
|
34
|
|
|
client_path = api.get_path(client) |
|
35
|
|
|
|
|
36
|
|
|
# get the UID of the current context (sample) |
|
37
|
|
|
sample_uid = api.get_uid(context) |
|
38
|
|
|
|
|
39
|
|
|
self.contentFilter = { |
|
40
|
|
|
"portal_type": "ARReport", |
|
41
|
|
|
"path": { |
|
42
|
|
|
"query": client_path, |
|
43
|
|
|
"depth": 2, |
|
44
|
|
|
}, |
|
45
|
|
|
# search all reports, where the current sample UID is included |
|
46
|
|
|
"sample_uid": [sample_uid], |
|
47
|
|
|
"sort_on": "created", |
|
48
|
|
|
"sort_order": "descending", |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
# disable the searchbox in this listing |
|
52
|
|
|
self.show_search = False |
|
53
|
|
|
|
|
54
|
|
|
# only allow the email transition at this level |
|
55
|
|
|
self.review_states = [ |
|
56
|
|
|
{ |
|
57
|
|
|
"id": "default", |
|
58
|
|
|
"title": "All", |
|
59
|
|
|
"contentFilter": {}, |
|
60
|
|
|
"columns": self.columns.keys(), |
|
61
|
|
|
"custom_transitions": [ |
|
62
|
|
|
self.send_email_transition, |
|
63
|
|
|
] |
|
64
|
|
|
}, |
|
65
|
|
|
] |
|
66
|
|
|
|