Skip to content

Commit afe1f9c

Browse files
committed
Add analyses listing adapter to force full view reload on submit
1 parent 4852463 commit afe1f9c

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# This file is part of SENAITE.AST.
4+
#
5+
# SENAITE.AST 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
7+
# Software 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 2020-2025 by it's authors.
19+
# Some rights reserved, see README and LICENSE.
20+
21+
from senaite.app.listing.interfaces import IListingView
22+
from senaite.app.listing.interfaces import IListingViewAdapter
23+
from senaite.ast.config import IDENTIFICATION_KEY
24+
from zope.component import adapter
25+
from zope.interface import implementer
26+
27+
@implementer(IListingViewAdapter)
28+
@adapter(IListingView)
29+
class AnalysesViewAdapter(object):
30+
"""Adapter for analyses listing
31+
"""
32+
33+
def __init__(self, listing, context):
34+
self.listing = listing
35+
self.context = context
36+
37+
def folder_item(self, obj, item, index):
38+
keyword = obj.getKeyword
39+
if keyword == IDENTIFICATION_KEY:
40+
# reload the current view on analysis submit to make the section
41+
# for the selection of AST panels to become visible and properly
42+
# populated with panels that include at least one of the selected
43+
# microorganisms
44+
item["reload"] = ["submit"]
45+
46+
def before_render(self):
47+
pass

src/senaite/ast/adapters/listing/configure.zcml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,11 @@
6161
provides="senaite.app.listing.interfaces.IListingViewAdapter"
6262
factory=".worksheet.AddAnalysesViewAdapter" />
6363

64+
<!-- Analyses listing adapter -->
65+
<subscriber
66+
for="bika.lims.browser.analyses.view.AnalysesView
67+
bika.lims.interfaces.IAnalysisRequest"
68+
provides="senaite.app.listing.interfaces.IListingViewAdapter"
69+
factory=".analyses.AnalysesViewAdapter" />
70+
6471
</configure>

0 commit comments

Comments
 (0)