forked from OCA/server-tools
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
504c616
commit 13d88e2
Showing
3 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ | |
from . import purge_tables | ||
from . import purge_data | ||
from . import purge_menus | ||
from . import ir_model_fields |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters