<commit_before>from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.Archetypes.BaseContent import BaseContent
from bika.lims.upgrade import stub


def LIMS1519(portal):
    """Migrate Archetypes SupplyOrderItem into a list of dictionaries.
    """
    stub('bika.lims.content.supplyorderitem', 'SupplyOrderItem',
         BaseContent)
    for order in portal['supplyorders'].objectValues():
        order.supplyorder_lineitems = []
        for soli in order.objectValues():
            item = dict(
                Product=soli.Product,
                Quantity=soli.Quantity,
                Price=soli.Price,
                VAT=soli.VAT,
            )
            order.supplyorder_lineitems.append(item)


def upgrade(tool):
    """Upgrade step required for Bika LIMS 3.1.7
    """
    portal = aq_parent(aq_inner(tool))
    setup = portal.portal_setup

    # Updated profile steps

    setup.runImportStepFromProfile('profile-bika.lims:default', 'jsregistry')
    setup.runImportStepFromProfile('profile-bika.lims:default', 'typeinfo')
    setup.runImportStepFromProfile('profile-bika.lims:default', 'workflow-csv')

    # Migrations

    LIMS1519(portal)

    return True<commit_msg>Upgrade step required for PR#1438<commit_after>from Acquisition import aq_inner
from Acquisition import aq_parent
from Products.Archetypes.BaseContent import BaseContent
from bika.lims.upgrade import stub


def LIMS1519(portal):
    """Migrate Archetypes SupplyOrderItem into a list of dictionaries.
    """
    stub('bika.lims.content.supplyorderitem', 'SupplyOrderItem',
         BaseContent)
    for order in portal['supplyorders'].objectValues():
        order.supplyorder_lineitems = []
        for soli in order.objectValues():
            item = dict(
                Product=soli.Product,
                Quantity=soli.Quantity,
                Price=soli.Price,
                VAT=soli.VAT,
            )
            order.supplyorder_lineitems.append(item)


def upgrade(tool):
    """Upgrade step required for Bika LIMS 3.1.7
    """
    portal = aq_parent(aq_inner(tool))
    setup = portal.portal_setup

    # Updated profile steps

    setup.runImportStepFromProfile('profile-bika.lims:default', 'jsregistry')
    setup.runImportStepFromProfile('profile-bika.lims:default', 'typeinfo')
    setup.runImportStepFromProfile('profile-bika.lims:default', 'workflow-csv')
    setup.runImportStepFromProfile('profile-bika.lims:default', 'plone.app.registry')

    # Migrations

    LIMS1519(portal)

    return True
{'fraction_non_alphanumeric': 0.09921259842519685, 'fraction_numerical': 0.010236220472440945, 'mean_word_length': 3.0721153846153846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1521693', 'n_tokens_mistral': 803, 'n_tokens_neox': 762, 'n_words': 147}