def migrate(cr, version): if not version: return cr.execute( """SELECT id FROM account_analytic_journal WHERE type='purchase' """) res = cr.fetchone() if res: openupgrade.add_xmlid(cr, 'account', 'exp', 'account.analytic.journal', res[0], True) openupgrade.rename_columns(cr, column_renames) openupgrade.rename_tables(cr, tables_renames) # drop views that inhibit changing field types. They will be recreated # anyways for view in [ 'analytic_entries_report', 'account_entries_report', 'report_invoice_created', 'report_aged_receivable' ]: cr.execute('drop view if exists %s cascade' % view) # delete a view from obsolete module account_report_company that causes # migration of the account module not to happen cleanly cr.execute("delete from ir_ui_view v " "using ir_model_data d where " "v.id=d.res_id and d.model='ir.ui.view' and " "d.name='account_report_company_invoice_report_tree_view'")
def migrate(cr, version): openupgrade.rename_columns(cr, column_renames) openupgrade.rename_xmlids(cr, xmlid_renames) openupgrade.rename_models(cr, [('survey', 'survey.survey'),('survey.answer','survey.label')]) openupgrade.rename_tables(cr, [('survey', 'survey_survey'),('survey_answer','survey_label')]) cr.execute("ALTER TABLE survey_page DROP CONSTRAINT IF EXISTS {}".format('survey_page_survey_id_fkey')) cr.execute("ALTER TABLE survey_question DROP CONSTRAINT IF EXISTS {}".format('survey_answer_question_id_fkey'))
def migrate(cr, version): openupgrade.rename_tables(cr, [('crm_meeting_type', 'calendar_event_type')]) openupgrade.rename_columns( cr, { 'calendar_event': [ ('end_date', 'date_final'), ('select1', 'month_by'), ('date', 'start_datetime'), ('date_deadline', 'stop_datetime'), ('alarm_id', None), ('base_calendar_alarm_id', None), ('base_calendar_url', None), ('exdate', None), ('exrule', None), ('month_list', None), ('organizer', None), ('organizer_id', None), ('sequence', None), ('vtimezone', None), ], 'calendar_alarm': [ ('action', 'type'), ('active', None), ('alarm_id', None), ('attach', None), ('description', None), ('duration', None), ('event_date', None), ('event_end_date', None), ('model_id', None), ('repeat', None), ('res_id', None), ('state', None), ('trigger_date', None), ('trigger_duration', 'duration'), ('trigger_interval', 'interval'), ('trigger_occurs', None), ('trigger_related', None), ('user_id', None), ], 'calendar_attendee': [ ('cutype', None), ('dir', None), ('member', None), ('ref', None), ('role', None), ('rsvp', None), ('user_id', None), ], }) # we create and prefill this fields (with bogus data, they will be # recomputed during post-migrate in order to avoid errors when creating # not null constraints cr.execute('''alter table calendar_event add column start timestamp without time zone, add column stop timestamp without time zone''') cr.execute('''update calendar_event set start=start_datetime, stop=stop_datetime''')
def migrate(cr, version): openupgrade.rename_columns(cr, column_renames) openupgrade.rename_xmlids(cr, xmlid_renames) initialize_location_inventory(cr) openupgrade.rename_tables(cr, [('stock_inventory_move_rel', None)]) create_stock_picking_fields(cr) create_stock_move_fields(cr)
def migrate(cr, version): openupgrade.rename_columns(cr, column_renames) openupgrade.rename_xmlids(cr, xmlid_renames) initialize_location_inventory(cr) openupgrade.rename_tables(cr, [('stock_inventory_move_rel', None)]) have_procurement = openupgrade.column_exists( cr, 'product_template', openupgrade.get_legacy_name('procure_method')) if have_procurement: swap_procurement_move_rel(cr)
def migrate(cr, version): openupgrade.rename_models(cr, [ ('crm.case.channel', 'crm.tracking.medium'), ('crm.case.resource.type', 'crm.tracking.campaign'), ]) openupgrade.rename_columns(cr, column_renames) openupgrade.rename_tables( cr, [('crm_case_channel', 'crm_tracking_medium'), ('crm_case_resource_type', 'crm_tracking_campaign')]) for constraint in ['crm_lead_channel_id_fkey', 'crm_lead_type_id_fkey']: cr.execute("ALTER TABLE crm_lead DROP CONSTRAINT IF EXISTS {}".format( constraint)) openupgrade.rename_xmlids(cr, xmlids)
def migrate(cr, version): if not version: return cr.execute( """SELECT id FROM account_analytic_journal WHERE type='purchase' """) res = cr.fetchone() if res: openupgrade.add_xmlid(cr, 'account', 'exp', 'account.analytic.journal', res[0], True) openupgrade.rename_columns(cr, column_renames) openupgrade.rename_tables(cr, tables_renames) # drop views that inhibit changing field types. They will be recreated # anyways for view in [ 'analytic_entries_report', 'account_entries_report', 'report_invoice_created', 'report_aged_receivable' ]: cr.execute('drop view if exists %s cascade' % view)
def migrate(cr, version): if not version: return openupgrade.rename_columns(cr, column_renames) openupgrade.rename_tables(cr, tables_renames)
def migrate(cr, version): openupgrade.rename_columns(cr, column_renames) drop_report_mrp_view(cr) openupgrade.rename_tables(cr, table_spec) check_production_state(cr) openupgrade.rename_xmlids(cr, xmlid_renames)