Skip to content

Commit

Permalink
Fix no selected services when adding a reference sample in a Worksheet (
Browse files Browse the repository at this point in the history
#2530)

* fix selected items list build

* udpate changelog

* #2530 - 1. fix filtering selected items; 2. refactoing; 3. optimize for PEP8:E501

* #2530 - rename method for getting selected values from supported services

* #2530 - rename method for getting selected values from supported services(2)

* #2530 - update changelog
  • Loading branch information
Bugerman58 committed Apr 18, 2024
1 parent 0ba30fc commit 7ab1baf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 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)
------------------

- #2530 Fix no selected services when adding a reference sample in a Worksheet
- #2521 Migrate Sample Templates to Dexterity
- #2524 Allow to edit the result capture date
- #2527 Fix clients groups are displayed on labcontact's user creation form
Expand Down
6 changes: 6 additions & 0 deletions src/bika/lims/browser/worksheet/views/referencesamples.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,15 @@ def folderitem(self, obj, item, index):
# Supported Services
supported_services_choices = self.make_supported_services_choices(obj)
item["choices"]["SupportedServices"] = supported_services_choices
item["SupportedServices"] = \
self.get_selected_values(supported_services_choices)

# Position
item["Position"] = "new"
item["choices"]["Position"] = self.make_position_choices()

return item

def get_selected_values(self, choices):
return [item.get("ResultValue") for item in choices
if item.get("selected", False)]

0 comments on commit 7ab1baf

Please sign in to comment.