def migrate(env, version): openupgrade.load_data( env.cr, 'stock_dropshipping', 'migrations/11.0.1.0/noupdate_changes.xml', ) update_sale_line_id(env)
def migrate(env, version): if not version: return # Reload communication data that must be updated openupgrade.load_data(env.cr, 'partner_communication_switzerland', 'data/depart_communications.xml')
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])
def migrate(env, version): move_fields_from_invoice_to_moves(env) change_type_purchase_order_date_approve(env) fill_account_move_purchase_order_rel_table(env) fill_purchase_order_line_qty_received_method(env.cr) openupgrade.load_data(env.cr, "purchase", "migrations/13.0.1.2/noupdate_changes.xml")
def reload_record_rule(env): openupgrade.load_data( env.cr, "hr_attendance_overtime_request", "security/ir_rule_data.xml", mode="update" )
def migrate(env, version): fill_product_template_attribute_value_attribute_line_id(env) fill_product_template_attribute_value__attribute_id_related(env) fill_product_variant_combination_table(env) openupgrade.load_data(env.cr, "product", "migrations/13.0.1.2/noupdate_changes.xml") convert_image_attachments(env)
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') """)
def migrate(env, version): update_procurement_fields(env) openupgrade.load_data( env.cr, 'purchase', 'migrations/11.0.1.2/noupdate_changes.xml', )
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"], )
def migrate(cr, version): if not version: return # Force reload security rules that have changed openupgrade.load_data(cr, 'website_event_compassion', 'security/access_rules.xml')
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')
def migrate(env, version): openupgrade.load_data(env.cr, "sale_commission", "migrations/13.0.1.0.0/noupdate_changes.xml") openupgrade.logged_query( env.cr, sql.SQL(""" UPDATE account_invoice_line_agent aila SET object_id = aml.id FROM account_move_line aml WHERE aml.old_invoice_line_id = aila.{} """).format(sql.Identifier(openupgrade.get_legacy_name("object_id"))), ) openupgrade.logged_query( env.cr, sql.SQL(""" UPDATE account_invoice_line_agent aila SET invoice_id = am.id FROM account_move am WHERE am.old_invoice_id = aila.{} """).format(sql.Identifier(openupgrade.get_legacy_name("invoice_id"))), ) openupgrade.logged_query( env.cr, """ UPDATE sale_commission_settlement scs SET invoice_id = am.id FROM account_move am WHERE am.old_invoice_id = scs.invoice """, ) openupgrade.logged_query( env.cr, sql.SQL(""" UPDATE sale_commission_settlement_line scsl SET invoice_line_id = aml.id FROM account_move_line aml WHERE aml.old_invoice_line_id = scsl.{} """).format(sql.Identifier( openupgrade.get_legacy_name("invoice_line_id"))), ) openupgrade.logged_query( env.cr, """ UPDATE account_move am SET commission_total = ai.commission_total FROM account_invoice ai WHERE ai.id = am.old_invoice_id AND ai.commission_total IS NOT NULL AND ai.commission_total != 0.0 """, ) openupgrade.logged_query( env.cr, """ UPDATE account_move_line aml SET commission_free = ail.commission_free FROM account_invoice_line ail WHERE aml.old_invoice_line_id = ail.id AND ail.commission_free """, )
def migrate(env, version): openupgrade.load_data(env.cr, "repair", "migrations/13.0.1.0/noupdate_changes.xml") update_repair_fee_invoice_relation(env) update_repair_line_invoice_relation(env) update_repair_order_invoice_relation(env) update_repair_order_user_id(env)
def migrate(cr, installed_version): openupgrade.load_data(cr, "l10n_it_reverse_charge", "migrations/13.0.1.0.0/noupdate_changes.xml") openupgrade.logged_query( cr, """ update account_move set rc_self_invoice_id = inv.rc_self_invoice_id, rc_purchase_invoice_id = inv.rc_purchase_invoice_id, rc_self_purchase_invoice_id = inv.rc_self_purchase_invoice_id from account_invoice inv where account_move.id = inv.move_id; """, ) openupgrade.logged_query( cr, """ update account_move_line aml set rc = invl.rc from account_invoice_line invl join account_invoice inv on inv.id = invl.invoice_id where aml.move_id = inv.move_id; """, )
def migrate(env, version): openupgrade.load_data(env.cr, 'mail', 'migrations/13.0.1.0/noupdate_changes.xml') # Convert track_visibility value to tracking value in ir_model_fields openupgrade.logged_query( env.cr, """ UPDATE ir_model_fields SET tracking = 100 WHERE track_visibility IS NOT NULL """, ) # Convert is_email value to notification_type value in mail_notification openupgrade.logged_query( env.cr, """ UPDATE mail_message_res_partner_needaction_rel SET notification_type = 'email' WHERE is_email; """) # Populate missing message_type values in mail_message following # https://github.com/OCA/OpenUpgrade/blob/d76498/addons/mail/models/mail_thread.py#L2192 # to https://github.com/OCA/OpenUpgrade/blob/d76498/odoo/tools/mail.py#L442 openupgrade.logged_query( env.cr, """ UPDATE mail_message SET message_type = 'user_notification' WHERE message_type = 'notification' and message_id like '%openerp-message-notify%'""") # Populate missing read_date values mail.notification openupgrade.logged_query( env.cr, """ UPDATE mail_message_res_partner_needaction_rel SET read_date = now() AT TIME ZONE 'UTC' WHERE is_read""", )
def migrate(env, version): openupgrade.logged_query( env.cr, """ UPDATE account_move am SET old_contract_id = ai.old_contract_id FROM account_invoice ai WHERE ai.id = am.old_invoice_id AND ai.old_contract_id IS NOT NULL""", ) openupgrade.logged_query( env.cr, """ UPDATE account_move_line aml SET contract_line_id = ail.contract_line_id FROM account_invoice_line ail WHERE ail.id = aml.old_invoice_line_id AND ail.contract_line_id IS NOT NULL""", ) openupgrade.load_data(env.cr, "contract", "migrations/13.0.1.0.0/noupdate_changes.xml") # Don't alter line recurrence v12 behavior openupgrade.logged_query( env.cr, "UPDATE contract_contract SET line_recurrence = True", )
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.rename_xmlids(env.cr, _xmlid_renames) openupgrade.load_data( env.cr, 'sale', 'migrations/11.0.1.0/noupdate_changes.xml', )
def migrate(env, version): openupgrade.load_data( env.cr, 'payment_transfer', 'migrations/11.0.1.0/noupdate_changes.xml', )
def migrate(env, version): fill_applicant_activities(env) openupgrade.load_data( env.cr, 'hr_recruitment', 'migrations/11.0.1.0/noupdate_changes.xml', )
def migrate(env, version): openupgrade.load_data( env.cr, 'payment_paypal', 'migrations/11.0.1.0/noupdate_changes.xml', ) _replace_paypal_view_template_id(env)
def migrate(env, version): if openupgrade.column_exists(env.cr, "hr_course", "migration_course_id"): return openupgrade.logged_query( env.cr, """ ALTER TABLE hr_course ADD COLUMN migration_course_id integer""", ) openupgrade.logged_query( env.cr, """ INSERT INTO hr_course ( name, category_id, permanence, permanence_time, migration_course_id ) SELECT name, category_id, permanence, permanence_time, id FROM hr_course_schedule """, ) openupgrade.logged_query( env.cr, """ UPDATE hr_course_schedule hcs SET course_id = hc.id FROM hr_course hc WHERE hc.migration_course_id = hcs.id """, ) openupgrade.load_data(env.cr, "hr_course", "migrations/14.0.2.0.0/noupdate_changes.xml")
def migrate(env, version): compute_stock_move_reference(env) compute_picking_scheduled_date(env) product_assign_responsible(env) create_specific_procurement_rules_from_globals(env) set_quant_reserved_qty(env) openupgrade.m2o_to_x2m( env.cr, env['stock.move'], 'stock_move', 'move_dest_ids', 'move_dest_id', ) # TODO: Get is_initial_demand_editable, is_locked values in stock.move set_partially_available_state(env) create_stock_move_line(env) fill_missing_lots_for_sml(env) create_stock_move_line_incoming(env) create_stock_move_line_reserved(env) create_stock_move_line_from_inventory_moves(env) fill_config_parameter_use_propagation_minimum_delta(env) recompute_stock_move_line_qty_different_uom(env) openupgrade.load_data( env.cr, 'stock', 'migrations/11.0.1.1/noupdate_changes.xml', )
def migrate(env, version): env['ir.ui.menu']._parent_store_compute() env['res.partner.category']._parent_store_compute() generate_thumbnails(env) update_res_company_onboarding_company_state(env) openupgrade.load_data(env.cr, 'base', 'migrations/12.0.1.3/noupdate_changes.xml')
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', ], )
def migrate(env, version): openupgrade.load_data( env.cr, 'website_blog', 'migrations/9.0.1.0/noupdate_changes.xml', ) convert_blog_post_cover(env)
def migrate(env, version): fill_stock_move_repair_id(env) openupgrade.load_data( env.cr, 'mrp_repair', 'migrations/11.0.1.0/noupdate_changes.xml', )
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', ], )
def migrate(cr, installed_version): openupgrade.load_data(cr, "l10n_it_intrastat_statement", "migrations/13.0.1.0.0/noupdate_changes.xml") to_be_updated = ( ("account_intrastat_statement_sale_section1", "invoice_id"), ("account_intrastat_statement_sale_section2", "invoice_id"), ("account_intrastat_statement_sale_section3", "invoice_id"), ("account_intrastat_statement_sale_section4", "invoice_id"), ("account_intrastat_statement_purchase_section1", "invoice_id"), ("account_intrastat_statement_purchase_section2", "invoice_id"), ("account_intrastat_statement_purchase_section3", "invoice_id"), ("account_intrastat_statement_purchase_section4", "invoice_id"), ) if openupgrade.table_exists(cr, "account_invoice"): for table, column in to_be_updated: openupgrade.logged_query( cr, sql.SQL("""UPDATE {table} t SET {column} = ai.move_id FROM account_invoice ai WHERE t.{column} = ai.id and ai.move_id is NOT NULL""").format( table=sql.Identifier(table), column=sql.Identifier(column), ), )
def migrate(cr, installed_version): openupgrade.load_data(cr, "l10n_it_withholding_tax", "migrations/13.0.1.0.0/noupdate_changes.xml") openupgrade.logged_query( cr, """ update account_move set withholding_tax = inv.withholding_tax, withholding_tax_amount = inv.withholding_tax_amount, amount_net_pay = inv.amount_net_pay, amount_net_pay_residual = inv.amount_net_pay_residual from account_invoice inv where account_move.id = inv.move_id; """, ) openupgrade.logged_query( cr, """ update account_invoice_withholding_tax set invoice_id = am.id from account_invoice inv join account_move am on am.id = inv.move_id where invoice_id = inv.id; """, )
def migrate(env, version): if not version: return # Reload communication data that must be updated openupgrade.load_data( env.cr, 'partner_communication_switzerland', 'data/depart_communications.xml')