From fc690c41b393fbfe25bfa7ab0095da6bc288f523 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 16 Mar 2018 11:47:39 +0000 Subject: [PATCH] [REF] module_auto_update: Step 1, move all deprecated stuff to deprecated files - Files are clearly suffixed with `_deprecated` so we know those features have no support nor migrations. - Views are removed, since updating from UI was too buggy to support it anymore. --- module_auto_update/__manifest__.py | 3 +- ...cron_data.xml => cron_data_deprecated.xml} | 0 module_auto_update/models/__init__.py | 2 +- .../{module.py => module_deprecated.py} | 0 module_auto_update/tests/__init__.py | 4 +- ...st_module.py => test_module_deprecated.py} | 30 ++++++------ ...e.py => test_module_upgrade_deprecated.py} | 0 module_auto_update/views/module_views.xml | 49 ------------------- module_auto_update/wizards/__init__.py | 2 +- ...pgrade.py => module_upgrade_deprecated.py} | 0 10 files changed, 21 insertions(+), 69 deletions(-) rename module_auto_update/data/{cron_data.xml => cron_data_deprecated.xml} (100%) rename module_auto_update/models/{module.py => module_deprecated.py} (100%) rename module_auto_update/tests/{test_module.py => test_module_deprecated.py} (93%) rename module_auto_update/tests/{test_module_upgrade.py => test_module_upgrade_deprecated.py} (100%) delete mode 100644 module_auto_update/views/module_views.xml rename module_auto_update/wizards/{module_upgrade.py => module_upgrade_deprecated.py} (100%) diff --git a/module_auto_update/__manifest__.py b/module_auto_update/__manifest__.py index 50a6578ae..93cdcaecf 100644 --- a/module_auto_update/__manifest__.py +++ b/module_auto_update/__manifest__.py @@ -24,7 +24,6 @@ 'base', ], 'data': [ - 'views/module_views.xml', - 'data/cron_data.xml', + 'data/cron_data_deprecated.xml', ], } diff --git a/module_auto_update/data/cron_data.xml b/module_auto_update/data/cron_data_deprecated.xml similarity index 100% rename from module_auto_update/data/cron_data.xml rename to module_auto_update/data/cron_data_deprecated.xml diff --git a/module_auto_update/models/__init__.py b/module_auto_update/models/__init__.py index e5ee3ea66..19086b02d 100644 --- a/module_auto_update/models/__init__.py +++ b/module_auto_update/models/__init__.py @@ -1,3 +1,3 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -from . import module +from . import module_deprecated diff --git a/module_auto_update/models/module.py b/module_auto_update/models/module_deprecated.py similarity index 100% rename from module_auto_update/models/module.py rename to module_auto_update/models/module_deprecated.py diff --git a/module_auto_update/tests/__init__.py b/module_auto_update/tests/__init__.py index 06952e34e..6c2171bab 100644 --- a/module_auto_update/tests/__init__.py +++ b/module_auto_update/tests/__init__.py @@ -1,4 +1,4 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -from . import test_module -from . import test_module_upgrade +from . import test_module_deprecated +from . import test_module_upgrade_deprecated diff --git a/module_auto_update/tests/test_module.py b/module_auto_update/tests/test_module_deprecated.py similarity index 93% rename from module_auto_update/tests/test_module.py rename to module_auto_update/tests/test_module_deprecated.py index 08fda9841..51f347677 100644 --- a/module_auto_update/tests/test_module.py +++ b/module_auto_update/tests/test_module_deprecated.py @@ -19,7 +19,7 @@ try: except ImportError: _logger.debug('Cannot `import checksumdir`.') -model = 'odoo.addons.module_auto_update.models.module' +model = 'odoo.addons.module_auto_update.models.module_deprecated' class EndTestException(Exception): @@ -179,19 +179,21 @@ class TestModule(TransactionCase): def test_create(self): """It should call _store_checksum_installed method""" _store_checksum_installed_mock = mock.MagicMock() - self.env['ir.module.module']._patch_method( - '_store_checksum_installed', - _store_checksum_installed_mock, - ) - vals = { - 'name': 'module_auto_update_test_module', - 'state': 'installed', - } - self.create_test_module(vals) - _store_checksum_installed_mock.assert_called_once_with(vals) - self.env['ir.module.module']._revert_method( - '_store_checksum_installed', - ) + try: + self.env['ir.module.module']._patch_method( + '_store_checksum_installed', + _store_checksum_installed_mock, + ) + vals = { + 'name': 'module_auto_update_test_module', + 'state': 'installed', + } + self.create_test_module(vals) + _store_checksum_installed_mock.assert_called_once_with(vals) + finally: + self.env['ir.module.module']._revert_method( + '_store_checksum_installed', + ) @mute_logger("openerp.modules.module") @mock.patch('%s.get_module_path' % model) diff --git a/module_auto_update/tests/test_module_upgrade.py b/module_auto_update/tests/test_module_upgrade_deprecated.py similarity index 100% rename from module_auto_update/tests/test_module_upgrade.py rename to module_auto_update/tests/test_module_upgrade_deprecated.py diff --git a/module_auto_update/views/module_views.xml b/module_auto_update/views/module_views.xml deleted file mode 100644 index 78a0be51e..000000000 --- a/module_auto_update/views/module_views.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - updates.module.search - ir.module.module - - - - - - - - - - - Open Updates and Update Apps List Server Action - - - if model.update_list(): - action = { - 'name': 'Updates', - 'type': 'ir.actions.act_window', - 'res_model': 'ir.module.module', - 'view_type': 'form', - 'view_mode': 'tree,form', - 'target': 'main', - 'context': '{"search_default_scheduled_upgrades": 1}', - } - - - - - - - - - - - - - - diff --git a/module_auto_update/wizards/__init__.py b/module_auto_update/wizards/__init__.py index 0448de3cf..bcaca7966 100644 --- a/module_auto_update/wizards/__init__.py +++ b/module_auto_update/wizards/__init__.py @@ -1,3 +1,3 @@ # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). -from . import module_upgrade +from . import module_upgrade_deprecated diff --git a/module_auto_update/wizards/module_upgrade.py b/module_auto_update/wizards/module_upgrade_deprecated.py similarity index 100% rename from module_auto_update/wizards/module_upgrade.py rename to module_auto_update/wizards/module_upgrade_deprecated.py