Skip to content

Commit

Permalink
Fix analysis instrument is not auto-assigned on change in worksheet (#…
Browse files Browse the repository at this point in the history
…2647)

* Instrument is not assigned to analyses when set in worksheet

* Changelog
  • Loading branch information
xispa authored Nov 27, 2024
1 parent 3858edd commit 74dfff2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 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.6.0 (unreleased)
------------------

- #2647 Fix analysis instrument is not auto-assigned on change in worksheet
- #2643 Improve performance of analysis verification
- #2645 Tabbed content view
- #2624 Added "Maximum holding time" setting to services and analyses
Expand Down
11 changes: 7 additions & 4 deletions src/bika/lims/browser/worksheet/ajax.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@

import plone
import plone.protect
from Products.Archetypes.config import REFERENCE_CATALOG

from bika.lims import api
from Products.CMFCore.utils import getToolByName
from Products.Five.browser import BrowserView

Expand Down Expand Up @@ -54,13 +55,15 @@ def __init__(self, context, request):
self.request = request

def __call__(self):
rc = getToolByName(self.context, REFERENCE_CATALOG)
plone.protect.CheckAuthenticator(self.request)
plone.protect.PostOnly(self.request)
value = self.request.get('value', '')
if not value:
raise Exception("Invalid instrument")
instrument = rc.lookupObject(value)

instrument = api.get_object_by_uid(value, None)
if not instrument:
raise Exception("Unable to lookup instrument")
self.context.setInstrument(instrument)

# set the instrument to the worksheet and analyses
self.context.setInstrument(instrument, override_analyses=True)

0 comments on commit 74dfff2

Please sign in to comment.