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

Fix hanging sampletype listing view in setup #2421

Merged
merged 3 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
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
- #2416 Fix Template select empties existing Sample Type-, Point- and Profile values in sample add form
- #2414 Fix missing empty selection in result option choices when no default value is set
- #2415 Fix sample specs get overwritten on manage analyses save
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