File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed
Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,16 @@ class CleanupPurgeWizardTable(models.TransientModel):
9696 _name = "cleanup.purge.wizard.table"
9797 _description = "Purge tables"
9898
99+ blacklist = [
100+ "endpoint_route" , # web-api/endpoint_route_handler
101+ ]
102+
99103 @api .model
100104 def find (self ):
101105 """
102106 Search for tables and views that cannot be instantiated.
103107 """
104- known_tables = []
108+ known_tables = list ( self . blacklist )
105109 for model in self .env ["ir.model" ].search ([]):
106110 if model .model not in self .env :
107111 continue
Original file line number Diff line number Diff line change 11# Copyright 2021 Camptocamp SA
22# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3- from psycopg2 import ProgrammingError
43
54from odoo .tests .common import tagged
6- from odoo .tools import mute_logger
5+ from odoo .tools import sql
76
87from .common import Common , environment
98
@@ -17,7 +16,12 @@ def test_empty_table(self):
1716 env .cr .execute ("create table database_cleanup_test (test int)" )
1817 wizard = env ["cleanup.purge.wizard.table" ].create ({})
1918 wizard .purge_all ()
20- with self .assertRaises (ProgrammingError ):
21- with env .registry .cursor () as cr :
22- with mute_logger ("odoo.sql_db" ):
23- cr .execute ("select * from database_cleanup_test" )
19+ self .assertFalse (sql .table_exists (env .cr , "database_cleanup_test" ))
20+
21+ def test_blacklist (self ):
22+ """A table mentioned in the blacklist is not purged"""
23+ with environment () as env :
24+ env .cr .execute ("create table if not exists endpoint_route (test int)" )
25+ wizard = env ["cleanup.purge.wizard.table" ].create ({})
26+ wizard .purge_all ()
27+ self .assertTrue (sql .table_exists (env .cr , "endpoint_route" ))
You can’t perform that action at this time.
0 commit comments