def migrate(cr, version):
    if not version:
        return

    # Move general fund product data
    openupgrade.rename_xmlids(
        cr,
        [('sponsorship_switzerland.product_template_fund_gen',
          'sponsorship_compassion.product_template_fund_gen')])
def migrate(cr, version):
    if not version:
        return

    # Move fields in another module
    openupgrade.update_module_moved_fields(
        cr, 'account.invoice', ['invoice_type'], 'sponsorship_switzerland',
        'sponsorship_compassion')
    openupgrade.update_module_moved_fields(
        cr, 'res.partner',
        ['is_church', 'church_id', 'church_member_count', 'member_ids'],
        'partner_compassion', 'sponsorship_compassion')
    openupgrade.rename_xmlids(
        cr,
        [('partner_compassion.res_partner_category_church',
          'sponsorship_compassion.res_partner_category_church')])
Esempio n. 3
0
def migrate(env, version):
    openupgrade.rename_xmlids(env.cr, _xmlid_renames)
Esempio n. 4
0
def migrate(env, version):
    cr = env.cr
    openupgrade.rename_tables(cr, _table_renames)
    openupgrade.rename_models(cr, _model_renames)
    openupgrade.rename_fields(env, _field_renames)
    openupgrade.rename_xmlids(cr, _xmlid_renames)
Esempio n. 5
0
def migrate(env, version):
    if not version:
        return

    ## rename field
    openupgrade.rename_fields(env, [
        ('lighting.product', 'lighting_product',
         'auxiliary_equipment_model_id', 'auxiliary_equipment_brand_id'),
    ])

    ### rename model
    openupgrade.rename_models(env.cr, [
        ('lighting.product.auxiliaryequipmentmodel',
         'lighting.product.auxiliaryequipmentbrand'),
    ])

    ### rename external ids
    openupgrade.rename_xmlids(env.cr, [
        ('lighting.product_auxiliaryequipmentmodel_elt',
         'lighting.product_auxiliaryequipmentbrand_elt'),
        ('lighting.product_auxiliaryequipmentmodel_meanwell',
         'lighting.product_auxiliaryequipmentbrand_meanwell'),
        ('lighting.product_auxiliaryequipmentmodel_tci',
         'lighting.product_auxiliaryequipmentbrand_tci'),
        ('lighting.product_auxiliaryequipmentmodel_tecnotrafo',
         'lighting.product_auxiliaryequipmentbrand_tecnotrafo'),
        ('lighting.product_auxiliaryequipmentmodel_tridonic',
         'lighting.product_auxiliaryequipmentbrand_tridonic'),
    ])

    ### rename DB
    ## lighting_product_auxiliaryequipmentmodel
    # rename table and sequence
    openupgrade.rename_tables(env.cr,
                              [('lighting_product_auxiliaryequipmentmodel',
                                'lighting_product_auxiliaryequipmentbrand')])

    # rename comments
    env.cr.execute("COMMENT ON TABLE lighting_product_auxiliaryequipmentbrand "
                   "IS 'lighting.product.auxiliaryequipmentbrand'")

    env.cr.execute(
        "COMMENT ON COLUMN lighting_product_auxiliaryequipmentbrand.name "
        "IS 'Auxiliary equipment brand'")

    # rename uniq keys
    env.cr.execute(
        "ALTER TABLE lighting_product_auxiliaryequipmentbrand "
        "RENAME CONSTRAINT lighting_product_auxiliaryequipmentmodel_name_uniq "
        "TO lighting_product_auxiliaryequipmentbrand_name_uniq")

    # rename pkeys
    env.cr.execute(
        "ALTER TABLE lighting_product_auxiliaryequipmentbrand "
        "RENAME CONSTRAINT lighting_product_auxiliaryequipmentmodel_pkey "
        "TO lighting_product_auxiliaryequipmentbrand_pkey")

    # rename fkeys
    env.cr.execute(
        "ALTER TABLE lighting_product_auxiliaryequipmentbrand "
        "RENAME CONSTRAINT lighting_product_auxiliaryequipmentmodel_create_uid_fkey "
        "TO lighting_product_auxiliaryequipmentbrand_create_uid_fkey")

    env.cr.execute(
        "ALTER TABLE lighting_product_auxiliaryequipmentbrand "
        "RENAME CONSTRAINT lighting_product_auxiliaryequipmentmodel_write_uid_fkey "
        "TO lighting_product_auxiliaryequipmentbrand_write_uid_fkey")

    ## lighting_product
    # rename comments
    env.cr.execute(
        "COMMENT ON COLUMN lighting_product.auxiliary_equipment_brand_id "
        "IS 'Auxiliary equipment brand'")

    # rename fkeys
    env.cr.execute(
        "ALTER TABLE lighting_product "
        "RENAME CONSTRAINT lighting_product_auxiliary_equipment_model_id_fkey "
        "TO lighting_product_auxiliary_equipment_brand_id_fkey")
Esempio n. 6
0
def migrate(env, version):
    openupgrade.rename_xmlids(env.cr, _xmlid_renames)
    openupgrade.set_xml_ids_noupdate_value(env, 'hr_timesheet',
                                           ['group_hr_timesheet_user'], True)
Esempio n. 7
0
def migrate(env, version):
    openupgrade.copy_columns(env.cr, column_copies)
    openupgrade.rename_xmlids(env.cr, xmlids_renames)
Esempio n. 8
0
def migrate(cr, version):
    openupgrade.rename_xmlids(cr, xmlid_renames)
Esempio n. 9
0
def migrate(env, version):
    openupgrade.rename_fields(env, _field_renames)
    openupgrade.rename_xmlids(env.cr, _xmlid_renames)
    move_lunch_order_line_to_lunch_order(env)
Esempio n. 10
0
def migrate_l10n_fr_siret_field(env):
    """If l10n_fr_siret is installed in version 10.0, we must rename xmlid"""
    if openupgrade.is_module_installed(env.cr, 'l10n_fr_siret'):
        openupgrade.rename_xmlids(env.cr,
                                  ('l10n_fr_siret.field_res_partner_siret',
                                   'l10n_fr.field_res_partner_siret'))
Esempio n. 11
0
def migrate(cr, version):
    """Update database from previous versions, before updating module."""
    rename_xmlids(cr, (("website.mass_mail_unsubscription_" + r,
                        "mass_mailing_custom_unsubscribe." + r)
                       for r in ("success", "failure")))
Esempio n. 12
0
def migrate(env, version):
    if openupgrade.column_exists(env.cr, 'hr_employee', 'vehicle_distance'):
        openupgrade.rename_fields(env, _field_renames)
    openupgrade.rename_xmlids(env.cr, xmlid_renames)
Esempio n. 13
0
def migrate(env, version):
    openupgrade.rename_fields(env, _field_renames)
    openupgrade.rename_xmlids(env.cr, _xmlid_renames)
    openupgrade.set_xml_ids_noupdate_value(
        env, 'hr_expense', ['hr_expense_template_refuse_reason'], True)