From eb236b0ec4931c2b3936e1682329483d5e2622c2 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/__openerp__.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} (92%) 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/__openerp__.py b/module_auto_update/__openerp__.py index 2621fb525..d6474ac94 100644 --- a/module_auto_update/__openerp__.py +++ b/module_auto_update/__openerp__.py @@ -25,7 +25,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 b27944126..0218659bb 100644 --- a/module_auto_update/models/__init__.py +++ b/module_auto_update/models/__init__.py @@ -2,4 +2,4 @@ # Copyright 2017 LasLabs Inc. # 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 237970451..2f298ef04 100644 --- a/module_auto_update/tests/__init__.py +++ b/module_auto_update/tests/__init__.py @@ -2,5 +2,5 @@ # Copyright 2017 LasLabs Inc. # 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 92% rename from module_auto_update/tests/test_module.py rename to module_auto_update/tests/test_module_deprecated.py index 4ed7bed08..15ded644a 100644 --- a/module_auto_update/tests/test_module.py +++ b/module_auto_update/tests/test_module_deprecated.py @@ -20,7 +20,7 @@ try: except ImportError: _logger.debug('Cannot `import checksumdir`.') -model = 'openerp.addons.module_auto_update.models.module' +model = 'openerp.addons.module_auto_update.models.module_deprecated' class TestModule(TransactionCase): @@ -141,19 +141,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 58cb00103..ab4eca2e4 100644 --- a/module_auto_update/wizards/__init__.py +++ b/module_auto_update/wizards/__init__.py @@ -2,4 +2,4 @@ # Copyright 2017 LasLabs Inc. # 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