コード例 #1
0
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
コード例 #2
0
ファイル: v01_01_006.py プロジェクト: nassimcha/sencua
def upgrade(tool):
    portal = tool.aq_inner.aq_parent
    setup = portal.portal_setup
    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))
        # The currently installed version is more recent than the target
        # version of this upgradestep
        return True

    logger.info("Upgrading {0}: {1} -> {2}".format(product, ver_from, version))

    # Convert ReferenceField's values into UIDReferenceFields.
    UpgradeReferenceFields()

    # Calculations not triggered in manage results view
    # https://github.com/senaite/bika.lims/issues/355
    # Since we've already migrated the ReferenceField DependentServices from
    # Calculation (with relation name 'CalculationAnalysisService' above, this
    # wouldn't be strictly necessary, but who knows... maybe we've lost the
    # at_references too, so just do it.
    fix_broken_calculations()

    # Backward compatibility with < 1.0.0
    RemoveARPriorities(portal)
    RemoveVersionableTypes()
    handle_AS_wo_category(portal)
    migrateFileFields(portal)

    # Indexes and colums were changed as per
    # https://github.com/senaite/bika.lims/pull/353
    ut.delIndex(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestUID')
    ut.addIndex(CATALOG_ANALYSIS_LISTING, 'getRequestUID', 'FieldIndex')
    ut.delColumn(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestURL')
    ut.delColumn(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestTitle')
    ut.addColumn(CATALOG_ANALYSIS_LISTING, 'getRequestURL')
    ut.addColumn(CATALOG_ANALYSIS_LISTING, 'getRequestTitle')
    ut.reindexIndex(CATALOG_ANALYSIS_LISTING, 'getPrioritySortkey')
    ut.refreshCatalogs()

    return True
コード例 #3
0
ファイル: v01_01_006.py プロジェクト: xispa/bika.lims
def upgrade(tool):
    portal = tool.aq_inner.aq_parent
    setup = portal.portal_setup
    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))
        # The currently installed version is more recent than the target
        # version of this upgradestep
        return True

    logger.info("Upgrading {0}: {1} -> {2}".format(product, ver_from, version))

    # Convert ReferenceField's values into UIDReferenceFields.
    UpgradeReferenceFields()

    # Calculations not triggered in manage results view
    # https://github.com/senaite/bika.lims/issues/355
    # Since we've already migrated the ReferenceField DependentServices from
    # Calculation (with relation name 'CalculationAnalysisService' above, this
    # wouldn't be strictly necessary, but who knows... maybe we've lost the
    # at_references too, so just do it.
    fix_broken_calculations()

    # Backward compatibility with < 1.0.0
    RemoveARPriorities(portal)
    RemoveVersionableTypes()
    handle_AS_wo_category(portal)
    migrateFileFields(portal)

    # Indexes and colums were changed as per
    # https://github.com/senaite/bika.lims/pull/353
    ut.delIndex(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestUID')
    ut.addIndex(CATALOG_ANALYSIS_LISTING, 'getRequestUID', 'FieldIndex')
    ut.delColumn(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestURL')
    ut.delColumn(CATALOG_ANALYSIS_LISTING, 'getAnalysisRequestTitle')
    ut.addColumn(CATALOG_ANALYSIS_LISTING, 'getRequestURL')
    ut.addColumn(CATALOG_ANALYSIS_LISTING, 'getRequestTitle')
    ut.reindexIndex(CATALOG_ANALYSIS_LISTING, 'getPrioritySortkey')
    ut.refreshCatalogs()

    return True