Holger Brunn
9 years ago
No known key found for this signature in database
GPG Key ID: 1C9760FECA3AE18
2 changed files with
4 additions and
9 deletions
-
database_cleanup/models/purge_columns.py
-
database_cleanup/models/purge_data.py
|
|
@ -3,7 +3,6 @@ |
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). |
|
|
|
from openerp import _, api, fields, models |
|
|
|
from openerp.exceptions import UserError |
|
|
|
from openerp.osv import fields as legacy_fields |
|
|
|
|
|
|
|
|
|
|
|
class CleanupPurgeLineColumn(models.TransientModel): |
|
|
@ -71,7 +70,7 @@ class CleanupPurgeWizardColumn(models.TransientModel): |
|
|
|
for model_pool in model_pools |
|
|
|
for column in model_pool._columns |
|
|
|
if not (isinstance(model_pool._columns[column], |
|
|
|
legacy_fields.function) and |
|
|
|
fields.fields.function) and |
|
|
|
not model_pool._columns[column].store) |
|
|
|
])) |
|
|
|
columns += models.MAGIC_COLUMNS |
|
|
|
|
|
@ -15,9 +15,7 @@ class CleanupPurgeLineData(models.TransientModel): |
|
|
|
|
|
|
|
@api.multi |
|
|
|
def purge(self): |
|
|
|
""" |
|
|
|
Unlink data entries upon manual confirmation. |
|
|
|
""" |
|
|
|
"""Unlink data entries upon manual confirmation.""" |
|
|
|
to_unlink = self.filtered(lambda x: not x.purged and x.data_id) |
|
|
|
self.logger.info('Purging data entries: %s', to_unlink.mapped('name')) |
|
|
|
to_unlink.mapped('data_id').unlink() |
|
|
@ -31,11 +29,9 @@ class CleanupPurgeWizardData(models.TransientModel): |
|
|
|
|
|
|
|
@api.model |
|
|
|
def find(self): |
|
|
|
""" |
|
|
|
Collect all rows from ir_model_data that refer |
|
|
|
"""Collect all rows from ir_model_data that refer |
|
|
|
to a nonexisting model, or to a nonexisting |
|
|
|
row in the model's table. |
|
|
|
""" |
|
|
|
row in the model's table.""" |
|
|
|
res = [] |
|
|
|
data_ids = [] |
|
|
|
unknown_models = [] |
|
|
|