def upgrade(tool): portal = tool.aq_inner.aq_parent ut = UpgradeUtils(portal) ver_from = ut.getInstalledVersion(product) if ut.isOlderVersion(product, version): logger.info("Skipping upgrade of {0}: {1} > {2}".format( product, ver_from, version)) return True logger.info("Upgrading {0}: {1} -> {2}".format(product, ver_from, version)) # -------- ADD YOUR STUFF HERE -------- ut.delIndexAndColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatient') ut.delIndexAndColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getDoctor') ut.addColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatientID') ut.addIndexAndColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatientTitle', 'FieldIndex') # In case if upgrade was already run after PR #72 got accepted ut.delColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatientURL') ut.addColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getPatientURL') ut.addColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getClientPatientID') ut.addIndexAndColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getDoctorTitle', 'FieldIndex') # In case if upgrade was already run after PR #72 got accepted ut.delColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getDoctorURL') ut.addColumn(CATALOG_ANALYSIS_REQUEST_LISTING, 'getDoctorURL') ut.addIndex(CATALOG_PATIENTS, 'listing_searchable_text', 'TextIndexNG3') ut.refreshCatalogs() logger.info("{0} upgraded to version {1}".format(product, version)) return True
def upgrade(tool): portal = tool.aq_inner.aq_parent ut = UpgradeUtils(portal) ver_from = ut.getInstalledVersion(product) if ut.isOlderVersion(product, version): logger.info("Skipping upgrade of {0}: {1} > {2}".format( product, ver_from, version)) return True logger.info("Upgrading {0}: {1} -> {2}".format(product, ver_from, version)) # Required to make filtering by department in worksheets work ut.addIndex(CATALOG_WORKSHEET_LISTING, 'getDepartmentUIDs', 'KeywordIndex') # Required by https://github.com/senaite/senaite.core/issues/683 ut.addIndexAndColumn('bika_catalog', 'getBatchUIDs', 'KeywordIndex') # Required by https://github.com/senaite/senaite.core/pulls/752 ut.delIndex(CATALOG_ANALYSIS_LISTING, 'getDateAnalysisPublished') ut.refreshCatalogs() # % Error subfield is meaningless in result ranges. Also, the system was # calculating the %Error based on the result (not based on the range), so # the shoulder from the left was always smaller than the shoulder from the # right. One could argue that this could be fixed easily by using the length # of the valid range to compute the shoulders by using the %error. Again, # this is a weak solution, cause in some cases the scale of the range might # be exponential, logaritmic (e.g. pH). Also, the sensitivity of the test # may differ when the result falls in one end or another. Thus, is for the # best interest of the labmanger to be able to set the shoulders (and # therefore, when the warnings must show up) manually. # See PR#694 remove_error_subfield_from_analysis_specs(portal, ut) # Reindex ReferenceAnalysis because of Calculation and Interims fields have # been added to Controls and Blanks. Until now, only routine analyses allowed # Calculations and Interim fields # Required by https://github.com/senaite/senaite.core/issues/735 reindex_reference_analysis(portal, ut) # reload type profiles so that the fix for # https://github.com/senaite/senaite.core/issues/590 # becomes effective setup = portal.portal_setup setup.runImportStepFromProfile('profile-bika.lims:default', 'typeinfo') logger.info("{0} upgraded to version {1}".format(product, version)) return True