Skip to content

Commit

Permalink
Fix hanging sampletype listing view in setup (#2421)
Browse files Browse the repository at this point in the history
* Remove samplepoint backrefs from sampletypes listing

* Changelog updated

---------

Co-authored-by: Jordi Puiggené <jp@naralabs.com>
  • Loading branch information
ramonski and xispa committed Nov 12, 2023
1 parent e7558cf commit 69abcbe
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Changelog
2.5.0 (unreleased)
------------------

- #2421 Fix hanging sampletype listing view in setup
- #2420 Fix page reload in multi results classic view
- #2419 Check permission when automatic sample reception is enabled
- #2416 Fix Template select empties existing Sample Type-, Point- and Profile values in sample add form
Expand Down
20 changes: 1 addition & 19 deletions src/bika/lims/controlpanel/bika_sampletypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@
from bika.lims.catalog import SETUP_CATALOG
from bika.lims.config import PROJECTNAME
from bika.lims.interfaces import ISampleTypes
from senaite.core.permissions import AddSampleType
from bika.lims.utils import get_link_for
from plone.app.folder.folder import ATFolder
from plone.app.folder.folder import ATFolderSchema
from Products.Archetypes import atapi
from Products.ATContentTypes.content import schemata
from senaite.core.interfaces import IHideActionsMenu
from senaite.core.permissions import AddSampleType
from zope.interface.declarations import implements

# TODO: Separate content and view into own modules!
Expand Down Expand Up @@ -99,9 +99,6 @@ def __init__(self, context, request):
("ContainerType", {
"title": _("Default Container"),
"toggle": True}),
("SamplePoints", {
"title": _("Sample Points"),
"toggle": True}),
))

self.review_states = [
Expand Down Expand Up @@ -165,21 +162,6 @@ def folderitem(self, obj, item, index):
vol = obj.getMinimumVolume()
item["getMinimumVolume"] = vol

# Hide sample points assigned to this sample type that do not belong
# to the same container (Client or Setup)
sample_points = obj.getSamplePoints()
path = api.get_path(self.context)
setup = api.get_setup()
if api.get_parent(self.context) == setup:
path = api.get_path(setup.bika_samplepoints)

sample_points = filter(lambda sp: api.get_parent_path(sp) == path,
sample_points)

# Display the links to the sample points
links = map(get_link_for, sample_points)
item["replace"]["SamplePoints"] = ", ".join(links)

return item


Expand Down

0 comments on commit 69abcbe

Please sign in to comment.