Skip to content

Commit

Permalink
Fix AttributeError on analysis update with interim values via jsonapi (
Browse files Browse the repository at this point in the history
…#2650)

* Use instance's REQUEST instead of kwargs's

* Changelog
  • Loading branch information
xispa authored Nov 29, 2024
1 parent 305beb3 commit dd5aab4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 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)
------------------

- #2650 Fix AttributeError on analysis update with interim values via jsonapi
- #2648 Increase the default width for field labels to min 150px
- #2647 Fix analysis instrument is not auto-assigned on change in worksheet
- #2643 Improve performance of analysis verification
Expand Down
5 changes: 3 additions & 2 deletions src/bika/lims/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,8 @@ class InterimFieldsValidator:
def __call__(self, value, *args, **kwargs):
instance = kwargs['instance']
fieldname = kwargs['field'].getName()
request = kwargs.get('REQUEST', {})
# do not rely on kwargs's REQUEST, cause it might be None!
request = instance.REQUEST
form = request.form
interim_fields = form.get(fieldname, [])

Expand All @@ -306,7 +307,7 @@ def __call__(self, value, *args, **kwargs):
# values
# this value in request prevents running once per subfield value.
key = instance.id + fieldname
if instance.REQUEST.get(key, False):
if request.get(key, False):
return True

for x in range(len(interim_fields)):
Expand Down

0 comments on commit dd5aab4

Please sign in to comment.