Florian da Costa
8 years ago
committed by
Holger Brunn
No known key found for this signature in database
GPG Key ID: 1C9760FECA3AE18
3 changed files with
19 additions and
0 deletions
-
database_cleanup/models/__init__.py
-
database_cleanup/models/ir_model_fields.py
-
database_cleanup/models/purge_models.py
|
@ -5,3 +5,4 @@ from . import purge_columns |
|
|
from . import purge_tables |
|
|
from . import purge_tables |
|
|
from . import purge_data |
|
|
from . import purge_data |
|
|
from . import purge_menus |
|
|
from . import purge_menus |
|
|
|
|
|
from . import ir_model_fields |
|
@ -0,0 +1,17 @@ |
|
|
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
|
|
# © 2014-2016 Therp BV <http://therp.nl> |
|
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
|
|
from openerp import api, models |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class IrModelFields(models.Model): |
|
|
|
|
|
_inherit = 'ir.model.fields' |
|
|
|
|
|
|
|
|
|
|
|
# In case of purging it means the model does not exist anymore in |
|
|
|
|
|
# installed module. In this specific case, we need to avoid to check |
|
|
|
|
|
# if fields can be removed as it would fail. |
|
|
|
|
|
@api.multi |
|
|
|
|
|
def _prepare_update(self): |
|
|
|
|
|
if self.env.context.get('purge'): |
|
|
|
|
|
self -= self.filtered(lambda x: x.model not in self.env.registry) |
|
|
|
|
|
return super(IrModelFields, self)._prepare_update() |
|
@ -54,6 +54,7 @@ class CleanupPurgeLineModel(models.TransientModel): |
|
|
context_flags = { |
|
|
context_flags = { |
|
|
MODULE_UNINSTALL_FLAG: True, |
|
|
MODULE_UNINSTALL_FLAG: True, |
|
|
'no_drop_table': True, |
|
|
'no_drop_table': True, |
|
|
|
|
|
'purge': True, |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
for line in self: |
|
|
for line in self: |
|
|