Browse Source

FIX when have a "dead" model that is still in DB

pull/14/head
Alexis de Lattre 8 years ago
committed by Pedro M. Baeza
parent
commit
2dd5f42c2e
  1. 4
      base_optional_quick_create/models/ir_model.py

4
base_optional_quick_create/models/ir_model.py

@ -25,7 +25,9 @@ class IrModel(models.Model):
if model.avoid_quick_create: if model.avoid_quick_create:
model_name = model.model model_name = model.model
model_obj = self.env.get(model_name) model_obj = self.env.get(model_name)
if model_name and not hasattr(model_obj, 'check_quick_create'):
if (
not isinstance(model_obj, type(None)) and
not hasattr(model_obj, 'check_quick_create')):
model_obj._patch_method('name_create', _wrap_name_create()) model_obj._patch_method('name_create', _wrap_name_create())
model_obj.check_quick_create = True model_obj.check_quick_create = True
return True return True

Loading…
Cancel
Save