fixup! [MIG] database_cleanup: Migration to 14.0

pull/2684/head
Tom Blauwendraat 2022-08-17 19:46:10 +02:00 committed by Miika Nissi
parent 7d8967fe32
commit 96e244055f
No known key found for this signature in database
GPG Key ID: B20DC9FCFAF92E7F
12 changed files with 37 additions and 22 deletions

View File

@ -77,7 +77,7 @@ class CleanupPurgeWizardModule(models.TransientModel):
{
"name": module.name,
}
).purge()
)
continue
res.append((0, 0, {"name": module.name}))

View File

@ -10,7 +10,7 @@ from odoo.exceptions import AccessDenied
class CleanupPurgeLine(models.AbstractModel):
""" Abstract base class for the purge wizard lines """
"""Abstract base class for the purge wizard lines"""
_name = "cleanup.purge.line"
_order = "name"
@ -34,7 +34,7 @@ class CleanupPurgeLine(models.AbstractModel):
class PurgeWizard(models.AbstractModel):
""" Abstract base class for the purge wizards """
"""Abstract base class for the purge wizards"""
_name = "cleanup.purge.wizard"
_description = "Purge stuff"

View File

@ -3,11 +3,8 @@
from odoo.modules.registry import Registry
from odoo.tests import TransactionCase
from odoo.tests.common import tagged
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class Common(TransactionCase):
def setUp(self):
super(Common, self).setUp()

View File

@ -1,9 +1,13 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import tagged
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCreateIndexesLine(Common):
def setUp(self):
super(TestCreateIndexesLine, self).setUp()

View File

@ -2,11 +2,14 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from psycopg2 import ProgrammingError
from odoo.tests.common import tagged
from odoo.tools import mute_logger
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCleanupPurgeLineColumn(Common):
def setUp(self):
super(TestCleanupPurgeLineColumn, self).setUp()

View File

@ -1,9 +1,13 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import tagged
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCleanupPurgeLineData(Common):
def setUp(self):
super(TestCleanupPurgeLineData, self).setUp()

View File

@ -1,9 +1,13 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import tagged
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCleanupPurgeLineMenu(Common):
def setUp(self):
super(TestCleanupPurgeLineMenu, self).setUp()

View File

@ -1,9 +1,13 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import tagged
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCleanupPurgeLineColumn(Common):
def setUp(self):
super(TestCleanupPurgeLineColumn, self).setUp()
@ -22,7 +26,7 @@ class TestCleanupPurgeLineColumn(Common):
self.env.registry.models.pop(self.model_name)
def tearDown(self):
""" We recreate the model to avoid registry Exception at loading """
"""We recreate the model to avoid registry Exception at loading"""
super(TestCleanupPurgeLineColumn, self).tearDown()
# FIXME: issue origin is not clear but it must be addressed.
self.model = self.env["ir.model"].create(self.model_values)

View File

@ -1,12 +1,13 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import threading
from odoo.tools import config
from odoo.tests.common import tagged
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCleanupPurgeLineModule(Common):
def setUp(self):
super(TestCleanupPurgeLineModule, self).setUp()
@ -20,16 +21,7 @@ class TestCleanupPurgeLineModule(Common):
def test_remove_to_upgrade_module(self):
wizard = self.env["cleanup.purge.wizard.module"].create({})
config.options["test_enable"] = False # Maybe useless now ?!
self.patch(threading.currentThread(), "testing", False)
wizard.purge_all()
config.options["test_enable"] = True # Maybe useless now ?!
self.patch(threading.currentThread(), "testing", True)
# must be removed by the wizard
self.assertFalse(
self.env["ir.module.module"].search(
[
("name", "=", "database_cleanup_test"),
]
)
module_names = wizard.purge_line_ids.filtered(lambda x: not x.purged).mapped(
"name"
)
self.assertTrue("database_cleanup_test" in module_names)

View File

@ -1,9 +1,13 @@
# Copyright 2021 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from odoo.tests.common import tagged
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCleanupPurgeLineProperty(Common):
def setUp(self):
super(TestCleanupPurgeLineProperty, self).setUp()

View File

@ -2,11 +2,14 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from psycopg2 import ProgrammingError
from odoo.tests.common import tagged
from odoo.tools import mute_logger
from .common import Common
# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class TestCleanupPurgeLineTable(Common):
def setUp(self):
super(TestCleanupPurgeLineTable, self).setUp()

View File

@ -15,7 +15,7 @@
<field name="state">code</field>
<field name="model_id" ref="database_cleanup.model_cleanup_purge_wizard_menu" />
<field name="code">
action = env.get('cleanup.purge.wizard').get_wizard_action()
action = env.get('cleanup.purge.wizard.menu').get_wizard_action()
</field>
</record>