diff --git a/CHANGES.rst b/CHANGES.rst index f73345ef35..cf6c2ba3d7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -35,6 +35,7 @@ Changelog **Removed** +- #1518 Removed stale indexes from `analysis_catalog` - #1516 Removed getResultsRange metadata from analysis_catalog - #1487 Dexterity Compatible Catalog Base Class - #1482 Remove `senaite.instruments` dependency for instrument import form diff --git a/bika/lims/browser/worksheet/views/add_analyses.py b/bika/lims/browser/worksheet/views/add_analyses.py index cb68b38c7f..1a9ea41930 100644 --- a/bika/lims/browser/worksheet/views/add_analyses.py +++ b/bika/lims/browser/worksheet/views/add_analyses.py @@ -82,7 +82,7 @@ def __init__(self, context, request): ("getClientOrderNumber", { "title": _("Order"), "toggle": False, - "index": "getClientOrderNumber"}), + "attr": "getClientOrderNumber"}), ("getRequestID", { "title": _("Request ID"), "attr": "getRequestID", diff --git a/bika/lims/catalog/analysis_catalog.py b/bika/lims/catalog/analysis_catalog.py index 0636d61b3f..a72f0ee279 100644 --- a/bika/lims/catalog/analysis_catalog.py +++ b/bika/lims/catalog/analysis_catalog.py @@ -39,14 +39,13 @@ "getParentUID": "FieldIndex", "getRequestUID": "FieldIndex", "getDueDate": "DateIndex", - "getDateSampled": "DateIndex", "getDateReceived": "DateIndex", "getResultCaptureDate": "DateIndex", "getClientUID": "FieldIndex", "getClientTitle": "FieldIndex", + # Only used in Productivity report: productivity_analysestats_overtime "getAnalyst": "FieldIndex", "getRequestID": "FieldIndex", - "getClientOrderNumber": "FieldIndex", "getKeyword": "FieldIndex", "getServiceUID": "FieldIndex", "getCategoryUID": "FieldIndex", @@ -57,8 +56,6 @@ "getReferenceAnalysesGroupID": "FieldIndex", "getMethodUID": "FieldIndex", "getInstrumentUID": "FieldIndex", - "getBatchUID": "FieldIndex", - "getAnalysisRequestPrintStatus": "FieldIndex", "getWorksheetUID": "FieldIndex", "getOriginalReflexedAnalysisUID": "FieldIndex", "getPrioritySortkey": "FieldIndex", diff --git a/bika/lims/content/abstractroutineanalysis.py b/bika/lims/content/abstractroutineanalysis.py index 41fbdd752e..eb55f2aed7 100644 --- a/bika/lims/content/abstractroutineanalysis.py +++ b/bika/lims/content/abstractroutineanalysis.py @@ -226,11 +226,11 @@ def getDateSampled(self): return None @security.public - def isSampleSampled(instance): + def isSampleSampled(self): """Returns whether if the Analysis Request this analysis comes from has been received or not """ - return instance.getDateSampled() and True or False + return self.getDateSampled() and True or False @security.public def getStartProcessDate(self): @@ -320,22 +320,6 @@ def getSampleTypeUID(self): if sample_type: return api.get_uid(sample_type) - @security.public - def getBatchUID(self): - """This method is used to populate catalog values - """ - request = self.getRequest() - if request: - return request.getBatchUID() - - @security.public - def getAnalysisRequestPrintStatus(self): - """This method is used to populate catalog values - """ - request = self.getRequest() - if request: - return request.getPrinted() - @security.public def getResultsRange(self): """Returns the valid result range for this routine analysis diff --git a/bika/lims/content/analysisrequest.py b/bika/lims/content/analysisrequest.py index 3cf0f25a02..b6ff1460b5 100644 --- a/bika/lims/content/analysisrequest.py +++ b/bika/lims/content/analysisrequest.py @@ -1554,7 +1554,6 @@ def setBatch(self, value=None): original_value = self.Schema().getField('Batch').get(self) if original_value != value: self.Schema().getField('Batch').set(self, value) - self._reindexAnalyses(['getBatchUID'], False) def getDefaultMemberDiscount(self): """Compute default member discount if it applies diff --git a/bika/lims/upgrade/v01_03_003.py b/bika/lims/upgrade/v01_03_003.py index 8e62a7b119..e754a882bd 100644 --- a/bika/lims/upgrade/v01_03_003.py +++ b/bika/lims/upgrade/v01_03_003.py @@ -181,6 +181,14 @@ # getCategoryUID --> category_uid ("bika_setup_catalog", "getCategoryUID"), + # Not used anywhere + (CATALOG_ANALYSIS_LISTING, "getAnalysisRequestPrintStatus"), + (CATALOG_ANALYSIS_LISTING, "getBatchUID"), + + # Only used in Add analyses (as sortable column) + (CATALOG_ANALYSIS_LISTING, "getClientOrderNumber"), + (CATALOG_ANALYSIS_LISTING, "getDateSampled"), + ] METADATA_TO_REMOVE = [ diff --git a/bika/lims/workflow/analysisrequest/events.py b/bika/lims/workflow/analysisrequest/events.py index 2b570ac17c..f5698238e8 100644 --- a/bika/lims/workflow/analysisrequest/events.py +++ b/bika/lims/workflow/analysisrequest/events.py @@ -171,9 +171,6 @@ def after_sample(analysis_request): passed in is performed """ analysis_request.setDateSampled(DateTime()) - idxs = ['getDateSampled'] - for analysis in analysis_request.getAnalyses(full_objects=True): - analysis.reindexObject(idxs=idxs) def after_rollback_to_receive(analysis_request):