def propagate_invoice_state(cr): """ Invoice state is now propagated from sale order to procurement to stock move and picking. We trace it back from the picking and update stock moves and procurements. First query courtesy of Ronald Portier. Postgres' explain analyse function showed that using subqueries are more performant than using UPDATE...FROM, at least in this case. """ openupgrade.logged_query( cr, """ UPDATE stock_move sm SET invoice_state = ( SELECT sp.invoice_state FROM stock_picking sp WHERE sm.picking_id = sp.id) WHERE picking_id IN ( SELECT id FROM stock_picking sp WHERE sm.picking_id = sp.id AND sm.invoice_state <> sp.invoice_state) """) openupgrade.logged_query( cr, """ UPDATE procurement_order po SET invoice_state = sm.invoice_state FROM stock_move sm WHERE sm.procurement_id = po.id """)
def migrate_stock_qty(cr, registry): """Reprocess stock moves in done state to fill stock.quant.""" # First set restrict_lot_id so that quants point to correct moves sql = ''' UPDATE stock_move SET restrict_lot_id = {} '''.format(openupgrade.get_legacy_name('prodlot_id')) openupgrade.logged_query(cr, sql) with api.Environment.manage(): env = api.Environment(cr, SUPERUSER_ID, {}) done_moves = env['stock.move'].search([('state', '=', 'done')], order="date") openupgrade.message( cr, 'stock', 'stock_move', 'state', 'Reprocess %s stock moves in state done to fill stock.quant', len(done_moves.ids)) done_moves.write({'state': 'draft'}) # Process moves using action_done. for move in done_moves: date_done = move.date move.action_done() # Rewrite date to keep old data move.date = date_done # Assign the same date for the created quants (not the existing) quants_to_rewrite = move.quant_ids.filtered( lambda x: x.in_date > date_done) quants_to_rewrite.write({'in_date': date_done})
def migrate_warehouse_id(cr, registry): warehouse_obj = registry['stock.warehouse'] location_obj = registry['stock.location'] map_locs = {} mlocs = [] warehouse_ids = warehouse_obj.search( cr, uid, []) for warehouse in warehouse_obj.browse(cr, uid, warehouse_ids): # Select all the child locations of this Warehouse location_ids = location_obj.search( cr, uid, [('id', 'child_of', warehouse.view_location_id.id)]) for location_id in location_ids: if location_id not in map_locs.keys(): map_locs[location_id] = warehouse.id for map_loc in map_locs.keys(): mloc = '(%d, %d)' % (map_loc, map_locs[map_loc]) mlocs.append(mloc) loc_map = ', '.join(mlocs) openupgrade.logged_query( cr, """ UPDATE sale_order_line SET warehouse_id = m.warehouse FROM (VALUES {loc_map}) AS m (location, warehouse) WHERE sale_order_line.{location_src_id} = m.location; """.format( location_src_id=openupgrade.get_legacy_name( 'location_src_id'), loc_map=loc_map))
def initialize_location_inventory(cr): """Stock Inventory is upgraded before Stock Warehouse. The default value of the field location_id (triggered by a missing NOT NULL constraint) is searched in the stock_warehouse table, asking for columns that has not been created yet because of the browse object. Therefore, precreate the column and fill with values from its own lines. Fallback on the stock location of the inventory's company's warehouse. """ cr.execute("ALTER TABLE stock_inventory ADD COLUMN location_id INTEGER") openupgrade.logged_query( cr, """ UPDATE stock_inventory si SET location_id = l.location_id FROM stock_inventory_line l WHERE l.inventory_id = si.id """) openupgrade.logged_query( cr, """ UPDATE stock_inventory si SET location_id = sw.lot_stock_id FROM stock_warehouse sw WHERE location_id is NULL AND (si.company_id = sw.company_id OR sw.company_id is NULL) """) cr.execute("ALTER TABLE stock_inventory " "ALTER COLUMN location_id SET NOT NULL")
def migrate_location_dest_id(cr): openupgrade.logged_query( cr, '''UPDATE purchase_order_line SET location_dest_id = {location_dest_id} WHERE {location_dest_id} is not null'''.format( location_dest_id=openupgrade.get_legacy_name('location_dest_id')))
def fix_domains(cr, pool): sql = """ UPDATE ir_act_window SET domain = NULL WHERE domain = '[(''bom_id'',''='',False)]' AND res_model = 'mrp.bom' """ openupgrade.logged_query(cr, sql)
def migrate(cr, version): # Drop view that inhibits changing field types. It will be recreated BTW cr.execute('drop view if exists report_document_user cascade') openupgrade.update_module_names( cr, apriori.renamed_modules.iteritems() ) openupgrade.rename_xmlids(cr, xml_ids) openupgrade.check_values_selection_field( cr, 'ir_act_report_xml', 'report_type', ['controller', 'pdf', 'qweb-html', 'qweb-pdf', 'sxw', 'webkit']) openupgrade.check_values_selection_field( cr, 'ir_ui_view', 'type', [ 'calendar', 'diagram', 'form', 'gantt', 'graph', 'kanban', 'qweb', 'search', 'tree']) # The tables stock.picking.in and stock.picking.out are merged into # stock.picking openupgrade.logged_query( cr, """ UPDATE ir_attachment SET res_model = 'stock.picking' WHERE res_model in ('stock.picking.in', 'stock.picking.out'); """) # Product.template is used for non variant product in v7 this was # product.product openupgrade.logged_query( cr, """ UPDATE ir_attachment SET res_model = 'product.template' WHERE res_model = 'product.product'; """)
def migrate_stock_qty(cr, registry): """Reprocess stock moves in done state to fill stock.quant.""" # First set restrict_lot_id so that quants point to correct moves sql = ''' UPDATE stock_move SET restrict_lot_id = {} '''.format(openupgrade.get_legacy_name('prodlot_id')) openupgrade.logged_query(cr, sql) with api.Environment.manage(): env = api.Environment(cr, SUPERUSER_ID, {}) done_moves = env['stock.move'].search( [('state', '=', 'done')], order="date") openupgrade.message( cr, 'stock', 'stock_move', 'state', 'Reprocess %s stock moves in state done to fill stock.quant', len(done_moves.ids)) done_moves.write({'state': 'draft'}) # disable all workflow steps - massive performance boost, no side # effects of workflow transitions with yet unknown condition set_workflow_org = models.BaseModel.step_workflow models.BaseModel.step_workflow = lambda *args, **kwargs: None # Process moves using action_done. for move in done_moves: date_done = move.date move.action_done() # Rewrite date to keep old data move.date = date_done # Assign the same date for the created quants (not the existing) quants_to_rewrite = move.quant_ids.filtered( lambda x: x.in_date > date_done) quants_to_rewrite.write({'in_date': date_done}) models.BaseModel.step_workflow = set_workflow_org
def populate_stock_move_fields(cr, registry): """ This function reduce creation time of the stock_move fields (See pre script, for more information) """ sm_obj = registry['stock.move'] logger.info("Fast creation of the field stock_move.product_qty (post)") # Set product_qty = product_uom_qty if uom_id of stock move # is the same as uom_id of product. (Main case) openupgrade.logged_query( cr, """ UPDATE stock_move sm1 SET product_qty = product_uom_qty FROM (SELECT sm2.id from stock_move sm2 INNER join product_product pp on sm2.product_id = pp.id INNER join product_template pt on pp.product_tmpl_id = pt.id where pt.uom_id = sm2.product_uom) as res WHERE sm1.id = res.id""") # Use ORM if uom id are different cr.execute("""SELECT sm2.id from stock_move sm2 INNER join product_product pp on sm2.product_id = pp.id INNER join product_template pt on pp.product_tmpl_id = pt.id where pt.uom_id != sm2.product_uom""") sm_ids = [row[0] for row in cr.fetchall()] qty_vals = sm_obj._quantity_normalize(cr, uid, sm_ids, None, None) for id, qty in qty_vals.iteritems(): cr.execute("UPDATE stock_move set product_qty = '%s' where id=%s" % (qty, id))
def create_properties(cr, pool): """ Fields moved to properties (standard_price). Write using the ORM so the prices will be written as properties. """ template_obj = pool['product.template'] sql = ("SELECT id, %s FROM product_template" % openupgrade.get_legacy_name('standard_price')) cr.execute(sql) logger.info("Creating product_template.standard_price properties" " for %d products." % (cr.rowcount)) for template_id, std_price in cr.fetchall(): template_obj.write(cr, SUPERUSER_ID, [template_id], {'standard_price': std_price}) # make properties global sql = (""" UPDATE ir_property SET company_id = null WHERE res_id like 'product.template,%%' AND name = 'standard_price'""") openupgrade.logged_query(cr, sql) # product.price.history entries have been generated with a value for # today, we want a value for the past as well, write a bogus date to # be sure that we have an historic value whenever we want cr.execute("UPDATE product_price_history SET " # calling a field 'datetime' is not really a good idea "datetime = '1970-01-01 00:00:00+00'")
def migrate(cr, version): openupgrade.logged_query( cr, "UPDATE base_action_rule SET kind = 'on_create_or_write', " "trg_date_range = null, trg_date_range_type = null " "where trg_date_id = null") openupgrade.logged_query( cr, "UPDATE base_action_rule SET kind = 'on_time', filter_pre_id = null " "where trg_date_id != null")
def bom_product_template(cr): openupgrade.logged_query( cr, """ UPDATE mrp_bom SET product_tmpl_id=pp.product_tmpl_id FROM product_product pp WHERE pp.id=mrp_bom.product_id """) cr.execute("ALTER TABLE mrp_bom ALTER COLUMN product_tmpl_id SET NOT NULL")
def fix_bom_templates(cr): """ In OpenERP 7.0, templates have been migrated to use a product_id as an exemplar so we need to move them to be products. """ openupgrade.logged_query( cr, """ UPDATE mrp_bom m SET product_id = (SELECT id FROM product_product pp WHERE pp.product_tmpl_id = m.product_tmpl_id LIMIT 1) WHERE m.product_tmpl_id IS NOT NULL """)
def migrate_stock_picking(cr, registry): """Update picking records with the correct picking_type_id and state. As elsewhere, multiple warehouses with the same company pose a problem. """ warehouse_obj = registry['stock.warehouse'] company_obj = registry['res.company'] picking_obj = registry['stock.picking'] type_legacy = openupgrade.get_legacy_name('type') for company in company_obj.browse(cr, uid, company_obj.search(cr, uid, [])): warehouse_ids = warehouse_obj.search(cr, uid, [('company_id', '=', company.id)]) if not warehouse_ids: picking_ids = picking_obj.search(cr, uid, [('company_id', '=', company.id)]) if not picking_ids: continue warehouse_ids = [ registry['ir.model.data'].xmlid_to_res_id( cr, uid, 'stock.warehouse0', raise_if_not_found=True) ] openupgrade.message( cr, 'stock', 'stock_picking', 'picking_type_id', 'No warehouse found for company %s, but this company does ' 'have pickings. Taking the default warehouse.', company.name) warehouse = warehouse_obj.browse(cr, uid, warehouse_ids[0]) if len(warehouse_ids) > 1: openupgrade.message( cr, 'stock', 'stock_picking', 'picking_type_id', 'Multiple warehouses found for company %s. Taking first' 'one found (%s) to determine the picking types for this ' 'company\'s pickings. Please verify this setting.', company.name, warehouse.name) # Fill picking_type_id required field for picking_type, type_id in (('in', warehouse.in_type_id.id), ('out', warehouse.out_type_id.id), ('internal', warehouse.int_type_id.id)): openupgrade.logged_query( cr, """ UPDATE stock_picking SET picking_type_id = %s WHERE {type_legacy} = %s """.format(type_legacy=type_legacy), ( type_id, picking_type, )) # state key auto -> waiting cr.execute("UPDATE stock_picking SET state = %s WHERE state = %s", ( 'waiting', 'auto', ))
def migrate_crm_lead_sale_order(cr): """Set new sale_order fields with value found in crm_lead, if sale_order.origin field mentions the crm_lead; - retrieve crm_lead.type_id to set sale_order.campaign_id; - retrieve crm_lead.channel_id to set sale_order.medium_id; """ openupgrade.logged_query(cr, """ UPDATE sale_order sale SET campaign_id = lead.campaign_id, medium_id = lead.medium_id FROM crm_lead lead WHERE sale.partner_id = lead.partner_id AND sale.origin like '%% '||lead.id; """)
def fix_bom_templates(cr): """ In OpenERP 7.0, templates have been migrated to use a product_id as an exemplar so we need to move them to be products. """ openupgrade.logged_query( cr, """ UPDATE mrp_bom m SET product_id = (SELECT id FROM product_product pp WHERE pp.product_tmpl_id = m.product_tmpl_id LIMIT 1) WHERE m.product_tmpl_id IS NOT NULL """)
def migrate_purchase_order(cr): """Copy currency_id from pricelist, as the field was a related non-stored one. :param cr: Database cursor """ openupgrade.logged_query( cr, """ UPDATE purchase_order po SET currency_id = pp.currency_id FROM product_pricelist pp WHERE pp.id = po.pricelist_id AND pp.currency_id != po.currency_id """)
def process_states(cr): """Map obsolete active states to 'running' and let the scheduler decide if these procurements are actually 'done'. Warn if there are procurements in obsolete draft state""" openupgrade.logged_query( cr, "UPDATE procurement_order SET state = %s WHERE state in %s", ('running', ('ready', 'waiting'))) cr.execute("SELECT COUNT(*) FROM procurement_order WHERE state = 'draft'") count = cr.fetchone()[0] if count: openupgrade.message( cr, 'procurement', 'procurement_order', 'state', 'In this database, %s procurements are in draft state. In ' 'Odoo 8.0, these procurements cannot be processed further.', count)
def migrate_procurement_order(cr, pool): """ In Odoo 8.0, stock moves generated for the procurement (moves from the supplier or production location to stock) are recorded on the procurement. For mrp procurements, gather them here. """ openupgrade.logged_query( cr, """ UPDATE stock_move sm SET procurement_id = proc.id FROM procurement_order proc WHERE proc.production_id = sm.production_id AND sm.production_id IS NOT NULL """)
def mail_mail_to_mail_message_migration(cr, uid, pool): """ The following fields have been moved from mail.mail to mail.message * mail_server_id * reply_to Get the mail.message from the mail.mail object and transfer the data that way. """ legacy_server_id = openupgrade.get_legacy_name('mail_server_id') legacy_reply_to = openupgrade.get_legacy_name('reply_to') openupgrade.logged_query(cr, """ UPDATE mail_message SET %s = %s, %s = %s FROM mail_message AS a JOIN mail_mail AS b ON a.id = b.mail_message_id """ % ('mail_server_id', legacy_server_id, 'reply_to', legacy_reply_to, ))
def update_paydays(cr): """ If column paydays exists in account_payment_term then module paydays was installed. We must propagate paydays to account_payment_term_line to avoid to lose data. """ if not openupgrade.column_exists(cr, 'account_payment_term', 'paydays'): return openupgrade.logged_query( cr, """ UPDATE account_payment_term_line aptl SET paydays = apt.paydays FROM account_payment_term apt WHERE apt.id = aptl.payment_id """)
def update_link_to_moves(cr): cr.execute(''' SELECT statement_line_id, move_id FROM bak_account_bank_statement_line_move_rel ORDER BY statement_line_id; ''') rows = cr.fetchall() for k, v in groupby(rows, key=lambda r: r[0]): v = list(v) assert len(v) == 1 openupgrade.logged_query( cr, '''UPDATE account_bank_statement_line SET journal_entry_id = %s WHERE id = %s;''', args=(v[0][1], v[0][0]) )
def migrate_stock_qty(cr, registry): """Reprocess stock moves in done state to fill stock.quant.""" # First set restrict_lot_id so that quants point to correct moves sql = ''' UPDATE stock_move SET restrict_lot_id = {} '''.format(openupgrade.get_legacy_name('prodlot_id')) openupgrade.logged_query(cr, sql) with api.Environment.manage(): env = api.Environment(cr, SUPERUSER_ID, {}) moves = env['stock.move'].search([('state', 'in', ['assign', 'done'])], order="date") for move in moves: if move.state == 'assign': _move_assign(env, move) else: _move_done(env, move)
def migrate_stock_warehouses(cr, registry): """Migrate all the warehouses""" # Add a code to all warehouses that have no code openupgrade.logged_query( cr, """ UPDATE stock_warehouse SET code= 'WH' || to_char(id, 'FM999MI') WHERE code IS NULL; """) # Set code cr.execute("""select id, code from stock_warehouse order by id asc""") res = cr.fetchall() # for wh in res: # if not wh[1]: # warehouse_obj.write(cr, uid, wh[0], {'code': 'WH%s' % (wh[0])}) # Migrate each warehouse for wh in res: _migrate_stock_warehouse(cr, registry, wh[0])
def populate_stock_move_fields(cr, registry): """ This function reduce creation time of the stock_move fields (See pre script, for more information) """ sm_obj = registry['stock.move'] logger.info("Fast creation of the field stock_move.product_qty (post)") # Set product_qty = product_uom_qty if uom_id of stock move # is the same as uom_id of product. (Main case) openupgrade.logged_query( cr, """ UPDATE stock_move sm1 SET product_qty = product_uom_qty FROM (SELECT sm2.id from stock_move sm2 INNER join product_product pp on sm2.product_id = pp.id INNER join product_template pt on pp.product_tmpl_id = pt.id where pt.uom_id = sm2.product_uom) as res WHERE sm1.id = res.id""") # Use ORM if uom id are different cr.execute("""SELECT sm2.id from stock_move sm2 INNER join product_product pp on sm2.product_id = pp.id INNER join product_template pt on pp.product_tmpl_id = pt.id where pt.uom_id != sm2.product_uom""") sm_ids = [row[0] for row in cr.fetchall()] qty_vals = sm_obj._quantity_normalize(cr, uid, sm_ids, None, None) for id, qty in qty_vals.iteritems(): cr.execute("UPDATE stock_move set product_qty = '%s' where id=%s" % (qty, id)) # If a stock move is Waiting availability ('confirmed'), but the source # location is 'supplier', 'inventory' or 'production', then set it as # Available ('assigned'). openupgrade.logged_query( cr, """ UPDATE stock_move sm1 SET state = 'assigned' FROM (SELECT sm2.id from stock_move sm2 INNER JOIN stock_location sl ON sm2.location_id = sl.id where sl.usage in ('supplier', 'inventory', 'production') and sm2.state = 'confirmed' ) as res WHERE sm1.id = res.id""")
def create_stock_picking_fields(cr): """ This function reduce creation time of the stock_picking fields """ logger.info("Fast creation of the field stock_picking.priority") cr.execute(""" ALTER TABLE stock_picking ADD COLUMN "priority" VARCHAR DEFAULT '1'""") # This request do the same as stock_picking.get_min_max_date but faster openupgrade.logged_query(cr, """ UPDATE stock_picking sp set priority = res.priority FROM ( SELECT picking_id, max(priority) as priority FROM stock_move WHERE priority > '1' GROUP BY picking_id) as res WHERE sp.id = res.picking_id""") logger.info("Fast creation of the field stock_picking.group_id") cr.execute(""" ALTER TABLE stock_picking ADD COLUMN "group_id" integer""")
def check_production_state(cr): """Check if a record with a state that is no longer supported (picking_except) exists in mrp_production and adjust it (to draft). """ if openupgrade.check_values_selection_field( cr, 'mrp_production', 'state', ['cancel', 'confirmed', 'done', 'draft', 'in_production', 'ready']): # if selection value doesn't exist, perform nothing return # Set picking_except to draft sql = """ SELECT id FROM mrp_production WHERE state = 'picking_except'""" cr.execute(sql) prod_ids = tuple([x for x, in tuple(cr.fetchall())]) sql = """ UPDATE mrp_production SET state = 'draft' WHERE id in %s""" openupgrade.logged_query(cr, sql, (tuple(prod_ids), ))
def migrate_procurement_order(cr): """ On procurements, purchase_id is replaced by purchase_line_id. We should be able to match most purchase lines because they got the procurement's move_id as their move_dest_id. Fallback on product_id, for presumably the manually created procurements without a related move from a sale or production order. In Odoo 8.0, stock moves generated for the procurement (moves from the supplier or production location to stock) are also recorded on the procurement. For purchase procurements, gather them here. """ openupgrade.logged_query( cr, """ UPDATE procurement_order proc SET purchase_line_id = pol.id FROM purchase_order_line pol WHERE proc.{purchase_id} = pol.order_id AND pol.{move_dest_id} IS NOT NULL AND pol.{move_dest_id} = proc.move_dest_id """.format(purchase_id=openupgrade.get_legacy_name('purchase_id'), move_dest_id=openupgrade.get_legacy_name('move_dest_id'))) openupgrade.logged_query( cr, """ UPDATE procurement_order proc SET purchase_line_id = pol.id FROM purchase_order_line pol WHERE proc.{purchase_id} = pol.order_id AND proc.purchase_line_id IS NULL AND pol.product_id = proc.product_id AND pol.id NOT IN ( SELECT purchase_line_id FROM procurement_order WHERE purchase_line_id IS NOT NULL) """.format(purchase_id=openupgrade.get_legacy_name('purchase_id'))) # Warn about dangling procurements cr.execute(""" SELECT count(*) FROM procurement_order WHERE purchase_line_id IS NULL AND {purchase_id} IS NOT NULL AND state NOT IN ('done', 'exception') """.format(purchase_id=openupgrade.get_legacy_name('purchase_id'))) count = cr.fetchone()[0] if count: logger.warning( "Failed to match the purchase order line for %s running " "procurements.", count) # Populate the moves generated from purchase procurements (the move_ids # field on the procurement order) openupgrade.logged_query( cr, """ UPDATE stock_move sm SET procurement_id = proc.id FROM procurement_order proc WHERE proc.purchase_line_id = sm.purchase_line_id AND sm.purchase_line_id IS NOT NULL """)
def migrate_stock_move_warehouse(cr): """ If a database featured multiple shops with the same company but a different warehouse, we can now propagate this warehouse to the associated stock moves. The warehouses were written on the procurements in the sale_stock module, while the moves were associated with the procurements in purchase and mrp. The order of processing between these modules seems to be independent, which is why we do this here in the deferred step. """ cr.execute("SELECT * FROM ir_module_module WHERE name='stock' " "AND state='installed'") if not cr.fetchone(): # No stock return openupgrade.logged_query( cr, """ UPDATE stock_move sm SET warehouse_id = po.warehouse_id FROM procurement_order po WHERE sm.procurement_id = po.id OR po.move_dest_id = sm.id """)
def update_hr_expense_ok(cr, pool): field_name = openupgrade.get_legacy_name('hr_expense_ok') template_obj = pool.get('product.template') openupgrade.logged_query( cr, """SELECT product_templ_id FROM product_product WHERE %s = 't';""" % field_name) template_ids = [row[0] for row in cr.fetchall()] template_obj.write(cr, SUPERUSER_ID, template_ids, {'hr_expense_ok': True}) for template_id in template_ids: openupgrade.logged_query( cr, """SELECT DISTINCT t.id FROM product_template t LEFT JOIN product_product p1 ON t.id = p1.product_tmpl_id LEFT JOIN product_product p2 ON t.id = p2.product_tmpl_id WHERE p1.%s = 't' AND p2.%s = 'f';""" % (field_name, field_name)) for row in cr.fetchall(): logger.warning( 'hr_expense_ok of product.template %d has been set to True ' 'whereas at least one of its product_product was False', row[0])
def migrate(cr, version): registry = RegistryManager.get(cr.dbname) openupgrade.map_values( cr, 'priority', openupgrade.get_legacy_name('priority'), [('5', '0'), ('4', '1'), ('3', '2'), ('2', '3'), ('1', '4')], table='crm_lead') openupgrade.map_values( cr, 'priority', openupgrade.get_legacy_name('priority'), [('5', '0'), ('4', '0'), ('3', '1'), ('1', '2')], table='crm_phonecall') openupgrade.logged_query( cr, "UPDATE crm_phonecall SET state = %s WHERE state = %s", ('draft', 'pending')) # Set the date of the last update subtype_ids = ( registry['ir.model.data'].get_object_reference( cr, SUPERUSER_ID, 'crm', 'mt_lead_stage')[1], registry['ir.model.data'].get_object_reference( cr, SUPERUSER_ID, 'crm', 'mt_salesteam_lead_stage')[1]) # Update event tracking datetime fields openupgrade_80.set_message_last_post( cr, SUPERUSER_ID, registry, ['crm.phonecall', 'crm.lead']) openupgrade.logged_query( cr, """ UPDATE crm_lead l SET date_last_stage_update = COALESCE( (SELECT MAX(create_date) FROM mail_message m WHERE subtype_id in %s AND m.res_id = l.id), l.create_date) """, (subtype_ids,)) # Move opportunity and phonecall to matching calendar_event openupgrade.logged_query( cr, """ UPDATE calendar_event e SET opportunity_id = m.opportunity_id, phonecall_id = m.phonecall_id FROM crm_meeting m WHERE e.{} = m.id""".format( openupgrade.get_legacy_name('crm_meeting_id'))) openupgrade.load_data(cr, 'crm', 'migrations/8.0.1.0/noupdate_changes.xml')