Browse Source

[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.
pull/1198/head
Jairo Llopis 7 years ago
committed by Stéphane Bidoul (ACSONE)
parent
commit
eb236b0ec4
No known key found for this signature in database GPG Key ID: BCAB2555446B5B92
  1. 3
      module_auto_update/__openerp__.py
  2. 0
      module_auto_update/data/cron_data_deprecated.xml
  3. 2
      module_auto_update/models/__init__.py
  4. 0
      module_auto_update/models/module_deprecated.py
  5. 4
      module_auto_update/tests/__init__.py
  6. 30
      module_auto_update/tests/test_module_deprecated.py
  7. 0
      module_auto_update/tests/test_module_upgrade_deprecated.py
  8. 49
      module_auto_update/views/module_views.xml
  9. 2
      module_auto_update/wizards/__init__.py
  10. 0
      module_auto_update/wizards/module_upgrade_deprecated.py

3
module_auto_update/__openerp__.py

@ -25,7 +25,6 @@
'base', 'base',
], ],
'data': [ 'data': [
'views/module_views.xml',
'data/cron_data.xml',
'data/cron_data_deprecated.xml',
], ],
} }

0
module_auto_update/data/cron_data.xml → module_auto_update/data/cron_data_deprecated.xml

2
module_auto_update/models/__init__.py

@ -2,4 +2,4 @@
# Copyright 2017 LasLabs Inc. # Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import module
from . import module_deprecated

0
module_auto_update/models/module.py → module_auto_update/models/module_deprecated.py

4
module_auto_update/tests/__init__.py

@ -2,5 +2,5 @@
# Copyright 2017 LasLabs Inc. # Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). # 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

30
module_auto_update/tests/test_module.py → module_auto_update/tests/test_module_deprecated.py

@ -20,7 +20,7 @@ try:
except ImportError: except ImportError:
_logger.debug('Cannot `import checksumdir`.') _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): class TestModule(TransactionCase):
@ -141,19 +141,21 @@ class TestModule(TransactionCase):
def test_create(self): def test_create(self):
"""It should call _store_checksum_installed method""" """It should call _store_checksum_installed method"""
_store_checksum_installed_mock = mock.MagicMock() _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") @mute_logger("openerp.modules.module")
@mock.patch('%s.get_module_path' % model) @mock.patch('%s.get_module_path' % model)

0
module_auto_update/tests/test_module_upgrade.py → module_auto_update/tests/test_module_upgrade_deprecated.py

49
module_auto_update/views/module_views.xml

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Module Search View -->
<record id="module_view_search" model="ir.ui.view">
<field name="name">updates.module.search</field>
<field name="model">ir.module.module</field>
<field name="inherit_id" ref="base.view_module_filter"/>
<field name="arch" type="xml">
<field name="category_id" position="after">
<filter name="scheduled_upgrades" string="Scheduled Upgrades" domain="[('state', '=', 'to upgrade')]"/>
</field>
</field>
</record>
<!--Open Updates Action (updates apps list first)-->
<record id="module_action_open_updates" model="ir.actions.server">
<field name="name">Open Updates and Update Apps List Server Action</field>
<field name="model_id" ref="model_ir_module_module"/>
<field name="code">
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}',
}
</field>
</record>
<!--Apps / Updates menu item-->
<menuitem
name="Updates"
action="module_action_open_updates"
id="module_menu_updates"
groups="base.group_no_one"
parent="base.menu_management"
sequence="20"/>
<!-- Menu in Settings > Technical for standard Updates link -->
<menuitem parent="base.menu_custom" sequence="27" name="Modules" id="menu_default_modules"/>
<!-- Moved standard Updates link -->
<record model="ir.ui.menu" id="base.menu_module_updates">
<field name="parent_id" ref="menu_default_modules"/>
</record>
</odoo>

2
module_auto_update/wizards/__init__.py

@ -2,4 +2,4 @@
# Copyright 2017 LasLabs Inc. # Copyright 2017 LasLabs Inc.
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). # License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
from . import module_upgrade
from . import module_upgrade_deprecated

0
module_auto_update/wizards/module_upgrade.py → module_auto_update/wizards/module_upgrade_deprecated.py

Loading…
Cancel
Save