diff --git a/trytond/ir/model.py b/trytond/ir/model.py index 266b1308ff..9ec296793d 100644 --- a/trytond/ir/model.py +++ b/trytond/ir/model.py @@ -1087,6 +1087,12 @@ class ModelData(ModelSQL, ModelView): where=model_data.inherit == True)) table.drop_column('inherit', True) + # Migration from 4.6: register buttons on ir module + cursor.execute(*model_data.update( + [model_data.module], ['ir'], + where=((model_data.module == 'res') + & (model_data.fs_id == 'model_data_sync_button')))) + @staticmethod def default_noupdate(): return False diff --git a/trytond/ir/module.py b/trytond/ir/module.py index f12e65bd2c..8888d2bba1 100644 --- a/trytond/ir/module.py +++ b/trytond/ir/module.py @@ -102,7 +102,12 @@ class Module(ModelSQL, ModelView): @classmethod def __register__(cls, module_name): + pool = Pool() + ModelData = pool.get('ir.model.data') TableHandler = backend.get('TableHandler') + sql_table = cls.__table__() + model_data_sql_table = ModelData.__table__() + cursor = Transaction().connection.cursor() # Migration from 3.6: remove double module old_table = 'ir_module_module' @@ -112,8 +117,6 @@ class Module(ModelSQL, ModelView): super(Module, cls).__register__(module_name) # Migration from 4.0: rename installed to activated - sql_table = cls.__table__() - cursor = Transaction().connection.cursor() cursor.execute(*sql_table.update( [sql_table.state], ['activated'], where=sql_table.state == 'installed')) @@ -121,6 +124,20 @@ class Module(ModelSQL, ModelView): [sql_table.state], ['not activated'], where=sql_table.state == 'uninstalled')) + # Migration from 4.6: register buttons on ir module + button_fs_ids = [ + 'module_activate_button', + 'module_activate_cancel_button', + 'module_deactivate_button', + 'module_deactivate_cancel_button', + 'module_upgrade_button', + 'module_upgrade_cancel_button', + ] + cursor.execute(*model_data_sql_table.update( + [model_data_sql_table.module], ['ir'], + where=((model_data_sql_table.module == 'res') + & (model_data_sql_table.fs_id.in_(button_fs_ids))))) + @staticmethod def default_state(): return 'not activated'