# -*- coding: utf-8 -*- def migrate(cr, version): """升级到 1.2:清理旧的 game.currency 记录与外部 ID,避免合并到 game.rule 时冲突。""" # 先删数据表记录,再删对应 ir.model.data 行 cr.execute("SELECT 1 FROM information_schema.tables WHERE table_name='game_currency'") if cr.fetchone(): cr.execute("DELETE FROM game_currency") cr.execute("DELETE FROM ir_model_data WHERE model='game.currency'")