Skip to content

Commit

Permalink
fixup! Merge pull request #1 from gurneyalex/15.0-database_cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
damdam-s committed May 3, 2022
1 parent fb5e7df commit c012c31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 3 additions & 1 deletion database_cleanup/models/purge_tables.py
Expand Up @@ -72,7 +72,9 @@ def purge(self):
)

self.logger.info("Dropping table %s", line.name)
self.env.cr.execute("DROP TABLE %s CASCADE", (IdentifierAdapter(line.name),))
self.env.cr.execute(
"DROP TABLE %s CASCADE", (IdentifierAdapter(line.name),)
)
line.write({"purged": True})
return True

Expand Down
7 changes: 3 additions & 4 deletions database_cleanup/tests/common.py
Expand Up @@ -3,8 +3,8 @@
from contextlib import contextmanager

import odoo
from odoo.modules.registry import Registry
from odoo.tests.common import tagged, TransactionCase
from odoo.tests import common
from odoo.tests.common import TransactionCase, tagged


@contextmanager
Expand All @@ -13,13 +13,12 @@ def new_rollbacked_env():
uid = odoo.SUPERUSER_ID
cr = registry.cursor()
try:
yield api.Environment(cr, uid, {})
yield odoo.api.Environment(cr, uid, {})
finally:
cr.rollback() # we shouldn't have to commit anything
cr.close()



# Use post_install to get all models loaded more info: odoo/odoo#13458
@tagged("post_install", "-at_install")
class Common(TransactionCase):
Expand Down

0 comments on commit c012c31

Please sign in to comment.