From ca09802b6e87c73457b8c1e242b911948164275c Mon Sep 17 00:00:00 2001 From: Ramon Bartl Date: Mon, 11 Nov 2024 11:58:54 +0100 Subject: [PATCH] Fix Attribute Error in Upgrade Step 2619 (#2642) * Handle non existing field * Changelog updated * comment added --- CHANGES.rst | 1 + src/senaite/core/upgrade/v02_06_000.py | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index a99c25ce2b..b2ddaf803a 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,7 @@ Changelog 2.6.0 (unreleased) ------------------ +- #2642 Fix Attribute Error in Upgrade Step 2619 - #2641 Fix AttributeError on rejection of samples without a contact set - #2640 Fix missing custom transitions via adapter in Worksheet's analyses - #2639 Fix sampletype-related indexes for AnalysisSpec type are not indexed diff --git a/src/senaite/core/upgrade/v02_06_000.py b/src/senaite/core/upgrade/v02_06_000.py index 295a0611de..133854fa15 100644 --- a/src/senaite/core/upgrade/v02_06_000.py +++ b/src/senaite/core/upgrade/v02_06_000.py @@ -2189,7 +2189,13 @@ def setup_result_types(tool): continue # check if it was set as a string result - string_result = obj.getField("StringResult").get(obj) + field = obj.getField("StringResult") + if not field: + # https://github.com/senaite/senaite.core/pull/2642 + logger.error("Field 'StringResult' not found on object %s (%s)" + % (api.get_path(obj), api.get_uid(obj))) + continue + string_result = field.get(obj) # get the results options type options_field = obj.getField("ResultOptionsType")