Ejemplo n.º 1
0
def migrate(cr, version):
    """
    It can be the case that procurement was not installed in the 7.0 database,
    as in 7.0 stock was a dependency of procurement and not the other way
    around like it is in 8.0. So we need to check if we are migrating a
    database in which procurement related stuff needs to be migrated.
    """
    registry = RegistryManager.get(cr.dbname)
    populate_stock_move_fields(cr, registry)
    have_procurement = openupgrade.column_exists(
        cr, 'product_template', openupgrade.get_legacy_name('procure_method'))

    migrate_stock_warehouses(cr, registry)
    migrate_stock_picking(cr, registry)
    migrate_stock_location(cr, registry)

    if have_procurement:
        migrate_stock_warehouse_orderpoint(cr)
        migrate_product_supply_method(cr, registry)
        migrate_procurement_order(cr, registry)

    migrate_stock_qty(cr, registry)
    migrate_stock_production_lot(cr, registry)

    # Initiate defaults before filling.
    openupgrade.set_defaults(cr, registry, default_spec, force=False)

    migrate_product(cr, registry)
    openupgrade.delete_model_workflow(cr, 'stock.picking')
    openupgrade_80.set_message_last_post(
        cr, uid, registry, ['stock.production.lot', 'stock.picking'])
    migrate_move_inventory(cr, registry)
    reset_warehouse_data_ids(cr, registry)
Ejemplo n.º 2
0
def migrate(cr, version):
    registry = RegistryManager.get(cr.dbname)

    # Initiate defaults before filling.
    openupgrade.set_defaults(cr, registry, default_spec, force=False)