diff --git a/CHANGES.rst b/CHANGES.rst index e5e5dd4c91..8a7dcd3c35 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -9,6 +9,7 @@ Changelog **Removed** +- #417 Remove calls to deprecated function getService (from AbstractAnalysis) **Changed** diff --git a/bika/lims/browser/analyses.py b/bika/lims/browser/analyses.py index 692b306b06..e8be3ff0b7 100644 --- a/bika/lims/browser/analyses.py +++ b/bika/lims/browser/analyses.py @@ -381,7 +381,7 @@ def isItemAllowed(self, obj): if ICatalogBrain.providedBy(obj): depuid = obj.getDepartmentUID else: - dep = obj.getService().getDepartment() + dep = obj.getDepartment() depuid = dep.UID() if dep else '' deps = self.request.get('filter_by_department_info', '') return not depuid or depuid in deps.split(',') diff --git a/bika/lims/browser/analysisrequest/workflow.py b/bika/lims/browser/analysisrequest/workflow.py index d26da23b76..3a8c3ec065 100644 --- a/bika/lims/browser/analysisrequest/workflow.py +++ b/bika/lims/browser/analysisrequest/workflow.py @@ -371,7 +371,7 @@ def workflow_action_submit(self): continue # Prevent saving data if the analysis is already transitioned if not (checkPermission(EditResults, analysis) or checkPermission(EditFieldResults, analysis)): - title = safe_unicode(analysis.getService().Title()) + title = safe_unicode(analysis.Title()) msgid = _('Result for ${analysis} could not be saved because ' 'it was already submitted by another user.', mapping={'analysis': title}) diff --git a/bika/lims/browser/attachment.py b/bika/lims/browser/attachment.py index 944d83a6b8..3a86452cad 100644 --- a/bika/lims/browser/attachment.py +++ b/bika/lims/browser/attachment.py @@ -317,8 +317,7 @@ def get_analyses(self): def is_analysis_attachment_allowed(self, analysis): """Checks if the analysis """ - service = analysis.getService() - if service.getAttachmentOption() not in ["p", "r"]: + if analysis.getAttachmentOption() not in ["p", "r"]: return False if api.get_workflow_status_of(analysis) in ["retracted"]: return False diff --git a/bika/lims/content/abstractroutineanalysis.py b/bika/lims/content/abstractroutineanalysis.py index ca603d56b4..d87728fc9c 100644 --- a/bika/lims/content/abstractroutineanalysis.py +++ b/bika/lims/content/abstractroutineanalysis.py @@ -615,8 +615,7 @@ def workflow_script_submit(self): # If the calculation associated to the dependent analysis requires # the manual introduction of interim fields, do not transition the # dependent automatically, force the user to do it manually. - service = dependent.getService() - calculation = service.getCalculation() + calculation = dependent.getCalculation() if calculation and calculation.getInterimFields(): continue diff --git a/bika/lims/content/referenceanalysis.py b/bika/lims/content/referenceanalysis.py index 1a7251e741..4dfb838967 100644 --- a/bika/lims/content/referenceanalysis.py +++ b/bika/lims/content/referenceanalysis.py @@ -110,10 +110,7 @@ def getServiceDefaultInstrumentUID(self): It is used as a metacolumn. Returns the default service's instrument UID """ - service = self.getService() - if not service: - return None - ins = service.getInstrument() + ins = self.getInstrument() if ins: return ins.UID() return '' @@ -123,10 +120,7 @@ def getServiceDefaultInstrumentTitle(self): It is used as a metacolumn. Returns the default service's instrument UID """ - service = self.getService() - if not service: - return None - ins = service.getInstrument() + ins = self.getInstrument() if ins: return ins.Title() return '' @@ -136,10 +130,7 @@ def getServiceDefaultInstrumentURL(self): It is used as a metacolumn. Returns the default service's instrument UID """ - service = self.getService() - if not service: - return None - ins = service.getInstrument() + ins = self.getInstrument() if ins: return ins.absolute_url_path() return '' diff --git a/bika/lims/tests/halt/test_manualuncertainty.py b/bika/lims/tests/halt/test_manualuncertainty.py index bcee168df9..41b6e9423c 100644 --- a/bika/lims/tests/halt/test_manualuncertainty.py +++ b/bika/lims/tests/halt/test_manualuncertainty.py @@ -168,19 +168,19 @@ def test_ar_manageresults_manualuncertainty(self): self.assertFalse(fe.getUncertainty()) self.assertEqual(fe.getResult(), '25.523345') self.assertEqual(fe.getPrecision(), 2) - self.assertEqual(fe.getService().getPrecision(), 2) + self.assertEqual(fe.getAnalysisService().getPrecision(), 2) self.assertEqual(fe.getFormattedResult(), '25.52') fe.setUncertainty('0.9') self.assertEqual(fe.getUncertainty(), 0.9) self.assertEqual(fe.getResult(), '25.523345') self.assertEqual(fe.getPrecision(), 1) - self.assertEqual(fe.getService().getPrecision(), 2) + self.assertEqual(fe.getAnalysisService().getPrecision(), 2) self.assertEqual(fe.getFormattedResult(), '25.5') fe.setUncertainty(None) self.assertFalse(fe.getUncertainty()) self.assertEqual(fe.getResult(), '25.523345') self.assertEqual(fe.getPrecision(), 2) - self.assertEqual(fe.getService().getPrecision(), 2) + self.assertEqual(fe.getAnalysisService().getPrecision(), 2) self.assertEqual(fe.getFormattedResult(), '25.52') def test_get_significant_digits(self):