示例#1
0
def migrate(env, version):
    openupgrade.delete_records_safely_by_xml_id(
        env, [
            "sale_expense.sale_order_rule_expense_user",
            "hr_expense.product_product_fixed_cost",
        ]
    )
示例#2
0
def migrate(env, version):
    cr = env.cr
    disable_account_payment_term_comp_rule(env)
    map_account_journal_bank_statements_source(cr)
    map_account_payment_term_line_option(cr)
    map_account_tax_type_tax_use(cr)
    env['account.group']._parent_store_compute()
    fill_account_chart_template_account_code_prefix(cr)
    update_res_company_account_helper_states(cr)
    update_res_company_account_setup_steps_states(cr)
    fill_account_journal_alias_id(env)
    fill_account_move_reverse_entry_id(env)
    recompute_invoice_taxes_add_analytic_tags(env)
    set_default_taxes(env)
    populate_fiscal_years(env)
    openupgrade.load_data(cr, 'account',
                          'migrations/12.0.1.1/noupdate_changes.xml')
    openupgrade.delete_record_translations(
        cr,
        'account',
        [
            'mail_template_data_payment_receipt',
            'email_template_edi_invoice',
        ],
    )
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            'account.mail_template_data_notification_email_account_invoice',
        ],
    )
def migrate(env, version):
    openupgrade.load_data(env.cr, 'calendar',
                          'migrations/12.0.1.0/noupdate_changes.xml')
    openupgrade.delete_record_translations(
        env.cr,
        'calendar',
        [
            'calendar_template_meeting_invitation',
            'calendar_template_meeting_changedate',
            'calendar_template_meeting_reminder',
        ],
    )
    event_calendar_type_xml_ids = [
        'calendar.categ_meet1',
        'calendar.categ_meet2',
        'calendar.categ_meet3',
        'calendar.categ_meet4',
        'calendar.categ_meet5',
    ]
    CalendarEvent = env['calendar.event']
    IrModelData = env['ir.model.data']
    for xml_id in event_calendar_type_xml_ids:
        record = env.ref(xml_id)
        if CalendarEvent.search([('categ_ids', '=', record.id)]):
            # delete only XML-ID, as type is used, but not "safely" detected
            module, name = xml_id.split('.')
            IrModelData.search([
                ('module', '=', module),
                ('name', '=', name),
            ]).unlink()
        else:
            openupgrade.delete_records_safely_by_xml_id(env, [xml_id])
示例#4
0
def migrate(env, version):
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            'website_mail.mail_template_data_module_install_website_mail',
        ],
    )
示例#5
0
def migrate(env, version):
    fill_project_project_inherits_values(env.cr)
    # openupgrade.load_data(
    #     env.cr, 'project', 'migrations/12.0.1.1/noupdate_changes.xml',
    #     mode='init_no_create')
    # TODO: change again when the 'init_no_create' works correctly
    task_14 = env.ref('project.project_task_data_14', False)
    if task_14:
        openupgrade.load_data(env.cr, 'project',
                              'migrations/12.0.1.1/noupdate_changes.xml')
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            'project.msg_task_data_14_attach',
            'project.msg_task_data_8_attach',
            'project.msg_task_data_14',
            'project.msg_task_data_8',
            'project.project_task_data_8',
        ],
    )
    openupgrade.logged_query(
        env.cr, """
        UPDATE ir_model_data
        SET noupdate = TRUE
        WHERE  module = 'project' AND (name = 'ir_cron_rating_project'
            OR name = 'rating_project_request_email_template')
        """)
示例#6
0
def migrate(env, version):
    cr = env.cr
    fill_hr_holidays_dates(cr)
    fill_hr_leave_type_validation_type(cr)
    fill_hr_leave_type_allocation_type(cr)
    fill_hr_leave(env)
    restore_resource_calendar_leave_link(env)
    fill_hr_leave_request_dates(cr)
    fill_hr_leave_allocation(env)
    set_max_sequences(env)
    openupgrade.load_data(
        cr, 'hr_holidays', 'migrations/12.0.1.5/noupdate_changes.xml')
    subscribe_new_subtypes(env)
    openupgrade.delete_records_safely_by_xml_id(
        env, [
            'hr_holidays.mt_department_holidays_approved',
            'hr_holidays.mt_department_holidays_confirmed',
            'hr_holidays.mt_department_holidays_first_validated',
            'hr_holidays.mt_department_holidays_refused',
            'hr_holidays.mt_holidays_approved',
            'hr_holidays.mt_holidays_confirmed',
            'hr_holidays.mt_holidays_first_validated',
            'hr_holidays.mt_holidays_refused',
        ],
    )
示例#7
0
def migrate(env, version):
    assign_employee_leave_manager(env)
    map_hr_leave_request_hour_from(env.cr)
    map_hr_leave_request_hour_to(env.cr)
    fill_leave_allocation_allocation_type(env.cr)
    openupgrade.delete_records_safely_by_xml_id(env, _unlink_by_xmlid)
    openupgrade.load_data(env.cr, 'hr_holidays', 'migrations/13.0.1.5/noupdate_changes.xml')
示例#8
0
def migrate(env, version):
    map_project_project_rating_status(env)
    _fill_res_users_m2m_tables(env)
    openupgrade.load_data(env.cr, "project", "14.0.1.1/noupdate_changes.xml")
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            "project.msg_task_4",
            "project.project_task_data_0",
            "project.project_task_data_1",
            "project.project_task_data_11",
            "project.project_task_data_12",
            "project.project_task_data_13",
            "project.project_task_data_14",
            "project.project_task_data_2",
            "project.project_task_data_4",
            "project.project_task_data_5",
            "project.project_task_data_6",
            "project.project_task_data_7",
            "project.project_task_data_9",
            "project.project_stage_data_0",
            "project.project_stage_data_1",
            "project.project_stage_data_2",
            # We do this at the end for assuring not having this records assigned on the
            # rest of the demo data
            "project.project_project_data",
            "project.project_tag_data",
        ],
    )
    openupgrade.delete_record_translations(
        env.cr,
        "project",
        ["mail_template_data_project_task", "rating_project_request_email_template"],
    )
示例#9
0
def migrate(env, version):
    move_fields_from_module(env)
    avoid_subproject_constraint(env)
    openupgrade.rename_xmlids(env.cr, renamed_xml_ids)
    openupgrade.delete_records_safely_by_xml_id(env, [
        'project.portal_issue_rule',  # Comes from website_project_issue
    ])
示例#10
0
def migrate(env, version):
    type_change_payment_transaction_and_sale_order(env)
    fill_res_company_portal_confirmation(env.cr)
    fill_sale_order_line_is_expense(env.cr)
    fill_sale_order_line_qty_delivered_method(env.cr)
    fill_sale_order_line_untaxed_amount_invoiced(env)
    fill_sale_order_line_untaxed_amount_to_invoice(env)
    if openupgrade.column_exists(
            env.cr, 'sale_order',
            openupgrade.get_legacy_name('commitment_date')):
        set_group_sale_order_dates(env.cr)
    openupgrade.load_data(env.cr, 'sale',
                          'migrations/12.0.1.1/noupdate_changes.xml')
    openupgrade.delete_record_translations(
        env.cr,
        'sale',
        [
            'email_template_edi_sale',
        ],
    )
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            'sale.mail_template_data_notification_email_sale_order',
        ],
    )
示例#11
0
def migrate(env, version):
    cr = env.cr
    openupgrade.delete_records_safely_by_xml_id(
        env,
        ['account.action_view_account_move_line_reconcile'],
    )
    openupgrade.copy_columns(cr, _column_copies)
    openupgrade.rename_columns(cr, _column_renames)
    openupgrade.rename_fields(env, _field_renames)
    openupgrade.rename_xmlids(cr, xmlid_renames)
    if openupgrade.table_exists(cr, 'sale_order'):
        openupgrade.rename_fields(env, _field_renames_sale)
    if openupgrade.table_exists(cr, 'sale_layout_category'):
        fill_account_invoice_line_sections(cr)
    if openupgrade.table_exists(cr, 'account_move_reverse'):
        # module account_reversal
        openupgrade.rename_fields(env, _field_renames_account_reversal)
    if not openupgrade.column_exists(env.cr, 'res_company', 'incoterm_id'):
        openupgrade.logged_query(
            env.cr,
            """
            ALTER TABLE res_company ADD COLUMN incoterm_id INTEGER""",
        )
    prefill_account_chart_template_transfer_account_prefix(env)
    openupgrade.set_xml_ids_noupdate_value(
        env, 'account', ['account_analytic_line_rule_billing_user'], False)
示例#12
0
def migrate(env, version):
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            'l10n_nl.tag_nl_13',
        ],
    )
示例#13
0
def remove_demo_survey_if_not_used(env):
    survey = env.ref("hr_recruitment_survey.recruitment_form")
    if (not env["hr.job"].search([("survey_id", "=", survey.id)])
            and not survey.answer_count):
        openupgrade.delete_records_safely_by_xml_id(
            env,
            ["hr_recruitment_survey.recruitment_form"],
        )
示例#14
0
def migrate(env, version):
    generate_stock_valuation_layer(env)
    openupgrade.delete_records_safely_by_xml_id(env, [
        "stock_account.default_cost_method",
        "stock_account.default_valuation",
        "stock_account.property_stock_account_input_prd",
        "stock_account.property_stock_account_output_prd",
    ])
示例#15
0
def migrate(env, version):
    openupgrade.load_data(env.cr, 'l10n_generic_coa',
                          'migrations/12.0.1.1/noupdate_changes.xml')
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            'l10n_generic_coa.transfer_account_id',
        ],
    )
示例#16
0
def migrate(env, version):
    # Current noupdate changes are better to not be applied for preserving continuity
    # openupgrade.load_data(env.cr, "mail", "14.0.1.0/noupdate_changes.xml")
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            "mail.mail_followers_read_write_own",
        ],
    )
示例#17
0
def migrate(env, version):
    openupgrade.load_data(
        env.cr, "website_blog", "migrations/13.0.1.0/noupdate_changes.xml")
    openupgrade.delete_records_safely_by_xml_id(
        env, [
            "website_blog.blog_post_cover_01",
            "website_blog.blog_post_cover_02",
        ]
    )
示例#18
0
def migrate(env, version):
    if not version:
        return
    openupgrade.rename_fields(env, _field_renames)
    # Remove old view that still contains reference to 'show_price'
    # otherwise the method '_check_xml' of 'ir.ui.view' raises an error
    # on calling 'postprocess_and_fields' method.
    openupgrade.delete_records_safely_by_xml_id(env, [
        'l10n_it_ddt.ddt_stock_picking_package_preparation_form',
    ])
def migrate(env, version):
    fill_pos_config_default_cashbox_id(env)
    fill_pos_config_amount_authorized_diff(env)
    fill_pos_session_move_id(env)
    fill_pos_order_account_move(env)
    fill_pos_config_barcode_nomenclature_id(env)
    fill_pos_config_module_pos_hr(env)
    delete_pos_order_line_with_empty_order_id(env)
    openupgrade.delete_records_safely_by_xml_id(env, _unlink_by_xmlid)
    openupgrade.load_data(env.cr, 'point_of_sale', 'migrations/13.0.1.0.1/noupdate_changes.xml')
示例#20
0
def migrate(env, version):
    update_hr_expense_state(env)
    openupgrade.load_data(
        env.cr, 'hr_expense', 'migrations/12.0.2.0/noupdate_changes.xml')
    openupgrade.delete_records_safely_by_xml_id(
        env, [
            'hr_expense.mt_department_expense_confirmed',
            'hr_expense.mt_expense_confirmed',
            'hr_expense.cat_expense',
        ],
    )
示例#21
0
def migrate(env, version):
    cr = env.cr
    fill_mrp_workcenter_resource_calendar_id(cr)
    openupgrade.load_data(
        cr, 'mrp', 'migrations/12.0.2.0/noupdate_changes.xml')
    fill_mrp_workcenter_productivity_loss_loss_id(cr)
    fill_stock_warehouse_picking_types(env)
    openupgrade.delete_records_safely_by_xml_id(
        env, [
            'mrp.sequence_mrp_prod',
        ],
    )
示例#22
0
def migrate(env, version):
    type_change_payment_transaction_and_sale_order(env)
    fill_sale_order_line_is_expense(env.cr)
    fill_sale_order_line_qty_delivered_method(env.cr)
    openupgrade.load_data(env.cr, 'sale',
                          'migrations/12.0.1.1/noupdate_changes.xml')
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            'sale.mail_template_data_notification_email_sale_order',
        ],
    )
示例#23
0
def migrate(env, version):
    fill_project_project_inherits_values(env)
    openupgrade.copy_columns(env.cr, column_copies)
    compute_project_task_rating_last_value(env)
    openupgrade.set_xml_ids_noupdate_value(
        env, 'project',
        ['ir_cron_rating_project', 'rating_project_request_email_template'],
        True)
    openupgrade.delete_records_safely_by_xml_id(
        env,
        ['project.duplicate_field_xmlid'],
    )
示例#24
0
def migrate(env, version):
    openupgrade.delete_records_safely_by_xml_id(env, _unlink_by_xmlid)
    openupgrade.load_data(env.cr, 'gamification',
                          'migrations/13.0.1.0/noupdate_changes.xml')
    openupgrade.delete_record_translations(
        env.cr,
        'gamification',
        [
            'email_template_badge_received',
            'simple_report_template',
        ],
    )
    convert_image_attachments(env)
示例#25
0
def migrate(env, version):
    copied_column = openupgrade.get_legacy_name('method_time')
    if not openupgrade.column_exists(env.cr, 'account_asset', copied_column):
        # We avoid this migration if `account_asset` was not installed in v11
        return
    adjust_asset_values(env)
    adjust_aml_values(env)
    handle_account_asset_disposal_migration(env)
    set_asset_line_previous(env)
    add_asset_initial_entry(env)
    openupgrade.delete_records_safely_by_xml_id(
        env, ["account_asset_management.account_asset_category_multi_company_rule",
              "account_asset_management.account_asset_asset_multi_company_rule"])
示例#26
0
def migrate(env, version):
    fill_hr_expense_company_id(env)
    fill_hr_expense_sheet_company_id(env)
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            "hr_expense.ir_rule_hr_expense_user",
            "hr_expense.ir_rule_hr_expense_sheet_user",
            "hr_expense.product_product_fixed_cost",
        ],
    )
    openupgrade.load_data(env.cr, 'hr_expense',
                          'migrations/13.0.2.0/noupdate_changes.xml')
示例#27
0
def migrate(env, version):
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            "utm.utm_campaign_christmas_special",
            "utm.utm_campaign_email_campaign_products",
            "utm.utm_campaign_email_campaign_services",
            "utm.utm_campaign_fall_drive",
            "utm.campaign_stage_1",
            "utm.campaign_stage_2",
            "utm.campaign_stage_3",
        ],
    )
示例#28
0
def migrate(env, version):
    fill_survey_survey_stage_id(env)
    move_survey_page_to_survey_question(env)
    fill_survey_user_input_line_question_sequence(env)
    openupgrade.delete_records_safely_by_xml_id(env, _unlink_by_xmlid)
    openupgrade.load_data(env.cr, 'survey',
                          'migrations/13.0.3.0/noupdate_changes.xml')
    openupgrade.delete_record_translations(
        env.cr,
        'survey',
        [
            'mail_template_user_input_invite',
        ],
    )
示例#29
0
def migrate(env, version):
    openupgrade.delete_records_safely_by_xml_id(
        env, [
            "l10n_ma.tax_tag_01",
            "l10n_ma.tax_tag_02",
            "l10n_ma.tax_tag_03",
            "l10n_ma.tax_tag_04",
            "l10n_ma.tax_tag_05",
            "l10n_ma.tax_tag_06",
            "l10n_ma.tax_tag_07",
            "l10n_ma.tax_tag_08",
            "l10n_ma.tax_tag_09",
        ],
    )
示例#30
0
def migrate(env, version):
    fill_mail_blacklist_crm_lead(env.cr)
    map_crm_team_dashboard_graph_model(env.cr)
    openupgrade.load_data(env.cr, 'crm',
                          'migrations/12.0.1.0/noupdate_changes.xml')
    openupgrade.delete_records_safely_by_xml_id(
        env,
        [
            'crm.crm_rule_all_lead_report',
            'crm.crm_rule_personal_lead_report',
            'crm.opp_report_multi_company',
            'crm.email_template_opportunity_reminder_mail',
            'crm.mail_template_data_module_install_crm',
        ],
    )