diff --git a/bika/lims/browser/analysisrequest/publish.py b/bika/lims/browser/analysisrequest/publish.py index a821e07581..05016807d4 100644 --- a/bika/lims/browser/analysisrequest/publish.py +++ b/bika/lims/browser/analysisrequest/publish.py @@ -845,7 +845,6 @@ def publishFromHTML(self, aruid, results_html): report.edit( AnalysisRequest=ar.UID(), Pdf=pdf_report, - Html=results_html, Recipients=recipients ) report.unmarkCreationFlag() diff --git a/bika/lims/content/arreport.py b/bika/lims/content/arreport.py index 16266210df..97d39626ca 100644 --- a/bika/lims/content/arreport.py +++ b/bika/lims/content/arreport.py @@ -31,8 +31,6 @@ ), BlobField('Pdf', ), - StringField('Html', - ), StringField('SMS', ), RecordsField('Recipients', diff --git a/bika/lims/upgrade/v3_2_0_1705.py b/bika/lims/upgrade/v3_2_0_1705.py index 2eb3e0e9fe..4dc15d2307 100644 --- a/bika/lims/upgrade/v3_2_0_1705.py +++ b/bika/lims/upgrade/v3_2_0_1705.py @@ -66,6 +66,9 @@ def upgrade(tool): if CATALOG_ANALYSIS_REQUEST_LISTING not in ut.refreshcatalog: ut.refreshcatalog.append(CATALOG_ANALYSIS_REQUEST_LISTING) + # Deleting 'Html' field from ARReport objects. + removeHtmlFromAR(portal) + # Refresh affected catalogs ut.refreshCatalogs() @@ -73,6 +76,24 @@ def upgrade(tool): return True +def removeHtmlFromAR(portal): + """ + 'Html' StringField has been deleted from ARReport Schema. + Now removing this attribute from old objects to save some memory. + """ + uc = getToolByName(portal, 'uid_catalog') + ar_reps = uc(portal_type='ARReport') + f_name = 'Html' + counter = 0 + for ar in ar_reps: + obj = ar.getObject() + if hasattr(obj, f_name): + delattr(obj, f_name) + counter += 1 + + logger.info("'Html' attribute has been removed from %d ARReport objects." + % counter) + def migareteFileFields(portal): """ This function walks over all attachment types and migrates their FileField @@ -99,3 +120,4 @@ def migareteFileFields(portal): logger.info( "Finished migration of FileField fields from {}." .format(portal_type)) +