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 sample specs get overwritten on manage analyses save #2415

Merged
merged 3 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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)
------------------

- #2415 Fix sample specs get overwritten on manage analyses save
- #2413 Fix select custom value for queryselect widget
- #2412 Layered listing searchable text adapter lookup
- #2409 Fix empty results get interpreted as 0.0 by 2-Dimensional-CSV importer
Expand Down
16 changes: 15 additions & 1 deletion src/bika/lims/browser/workflow/analysisrequest.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,13 @@ def __call__(self, action, objects):
hidden = map(lambda o: {
"uid": api.get_uid(o), "hidden": self.is_hidden(o)
}, services)
specs = map(lambda service: self.get_specs(service), services)

# Do not overwrite default result ranges set through sample
# specification field unless the edition of specs at analysis
# level is explicitely allowed
specs = []
if self.is_ar_specs_enabled:
specs = map(lambda service: self.get_specs(service), services)

# Set new analyses to the sample
sample.setAnalysisServicesSettings(hidden)
Expand All @@ -459,6 +465,14 @@ def __call__(self, action, objects):
# Redirect the user to success page
self.success([sample])

@property
def is_ar_specs_enabled(self):
"""Returns whether the assignment of specs at analysis level within
sample context is enabled or not
"""
setup = api.get_setup()
return setup.getEnableARSpecs()

def is_hidden(self, service):
"""Returns whether the request Hidden param for the given obj is True
"""
Expand Down