Browse Source

[FIX] more review

pull/469/head
Holger Brunn 9 years ago
parent
commit
908c1ed514
No known key found for this signature in database GPG Key ID: 1C9760FECA3AE18
  1. 3
      database_cleanup/models/purge_columns.py
  2. 10
      database_cleanup/models/purge_data.py

3
database_cleanup/models/purge_columns.py

@ -3,7 +3,6 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import _, api, fields, models from openerp import _, api, fields, models
from openerp.exceptions import UserError from openerp.exceptions import UserError
from openerp.osv import fields as legacy_fields
class CleanupPurgeLineColumn(models.TransientModel): class CleanupPurgeLineColumn(models.TransientModel):
@ -71,7 +70,7 @@ class CleanupPurgeWizardColumn(models.TransientModel):
for model_pool in model_pools for model_pool in model_pools
for column in model_pool._columns for column in model_pool._columns
if not (isinstance(model_pool._columns[column], if not (isinstance(model_pool._columns[column],
legacy_fields.function) and
fields.fields.function) and
not model_pool._columns[column].store) not model_pool._columns[column].store)
])) ]))
columns += models.MAGIC_COLUMNS columns += models.MAGIC_COLUMNS

10
database_cleanup/models/purge_data.py

@ -15,9 +15,7 @@ class CleanupPurgeLineData(models.TransientModel):
@api.multi @api.multi
def purge(self): 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) to_unlink = self.filtered(lambda x: not x.purged and x.data_id)
self.logger.info('Purging data entries: %s', to_unlink.mapped('name')) self.logger.info('Purging data entries: %s', to_unlink.mapped('name'))
to_unlink.mapped('data_id').unlink() to_unlink.mapped('data_id').unlink()
@ -31,11 +29,9 @@ class CleanupPurgeWizardData(models.TransientModel):
@api.model @api.model
def find(self): 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 to a nonexisting model, or to a nonexisting
row in the model's table.
"""
row in the model's table."""
res = [] res = []
data_ids = [] data_ids = []
unknown_models = [] unknown_models = []

Loading…
Cancel
Save