Skip to content

Commit 2b922f8

Browse files
authored
Fix sample specs get overwritten on manage analyses save (#2415)
* Do not overwrite sample specs unless explicitely set * Remove pdb * Changelog
1 parent 53a5280 commit 2b922f8

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

CHANGES.rst

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Changelog
44
2.5.0 (unreleased)
55
------------------
66

7+
- #2415 Fix sample specs get overwritten on manage analyses save
78
- #2413 Fix select custom value for queryselect widget
89
- #2412 Layered listing searchable text adapter lookup
910
- #2409 Fix empty results get interpreted as 0.0 by 2-Dimensional-CSV importer

src/bika/lims/browser/workflow/analysisrequest.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,13 @@ def __call__(self, action, objects):
439439
hidden = map(lambda o: {
440440
"uid": api.get_uid(o), "hidden": self.is_hidden(o)
441441
}, services)
442-
specs = map(lambda service: self.get_specs(service), services)
442+
443+
# Do not overwrite default result ranges set through sample
444+
# specification field unless the edition of specs at analysis
445+
# level is explicitely allowed
446+
specs = []
447+
if self.is_ar_specs_enabled:
448+
specs = map(lambda service: self.get_specs(service), services)
443449

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

468+
@property
469+
def is_ar_specs_enabled(self):
470+
"""Returns whether the assignment of specs at analysis level within
471+
sample context is enabled or not
472+
"""
473+
setup = api.get_setup()
474+
return setup.getEnableARSpecs()
475+
462476
def is_hidden(self, service):
463477
"""Returns whether the request Hidden param for the given obj is True
464478
"""

0 commit comments

Comments
 (0)