You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
656 B

8 years ago
  1. # -*- coding: utf-8 -*-
  2. # © 2014-2016 Therp BV <http://therp.nl>
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
  4. from openerp import api, models
  5. class IrModelFields(models.Model):
  6. _inherit = 'ir.model.fields'
  7. # In case of purging it means the model does not exist anymore in
  8. # installed module. In this specific case, we need to avoid to check
  9. # if fields can be removed as it would fail.
  10. @api.multi
  11. def _prepare_update(self):
  12. if self.env.context.get('purge'):
  13. self -= self.filtered(lambda x: x.model not in self.env.registry)
  14. return super(IrModelFields, self)._prepare_update()