diff --git a/bika/lims/upgrade/v01_03_004.py b/bika/lims/upgrade/v01_03_004.py
index <HASH>..<HASH> 100644
--- a/bika/lims/upgrade/v01_03_004.py
+++ b/bika/lims/upgrade/v01_03_004.py
@@ -213,9 +213,10 @@ def update_dynamic_analysisspecs(portal):
 
         # Unset/set the specification
         logger.info("Updating specification '{}' of smaple '{}'".format(
-            spec.Title(), sample.getId()))
-        sample.setAnalysisSpec(None)
-        sample.setAnalysisSpec(spec)
+            spec.Title(), obj.getId()))
+
+        obj.setSpecification(None)
+        obj.setSpecification(spec)
 
     logger.info("Updating specifications with dynamic results ranges [DONE]")
Fix variable in upgrade step (#<I>)