[IMP] custom model allowed
bzr revid: fp@tinyerp.com-20121227172825-lny2fobb5g89edca
This commit is contained in:
parent
fc8ba82578
commit
aa86fb2bc1
|
@ -199,7 +199,7 @@ class ir_model(osv.osv):
|
|||
|
||||
def instanciate(self, cr, user, model, context=None):
|
||||
class x_custom_model(osv.osv):
|
||||
pass
|
||||
_custom = True
|
||||
x_custom_model._name = model
|
||||
x_custom_model._module = False
|
||||
a = x_custom_model.create_instance(self.pool, cr)
|
||||
|
|
|
@ -629,7 +629,8 @@ class MetaModel(type):
|
|||
self._module = module_name
|
||||
|
||||
# Remember which models to instanciate for this module.
|
||||
self.module_to_models.setdefault(self._module, []).append(self)
|
||||
if not self._custom:
|
||||
self.module_to_models.setdefault(self._module, []).append(self)
|
||||
|
||||
|
||||
# Definition of log access columns, automatically added to models if
|
||||
|
@ -666,6 +667,7 @@ class BaseModel(object):
|
|||
_name = None
|
||||
_columns = {}
|
||||
_constraints = []
|
||||
_custom = False
|
||||
_defaults = {}
|
||||
_rec_name = None
|
||||
_parent_name = 'parent_id'
|
||||
|
@ -942,7 +944,8 @@ class BaseModel(object):
|
|||
# managed by the metaclass.
|
||||
module_model_list = MetaModel.module_to_models.setdefault(cls._module, [])
|
||||
if cls not in module_model_list:
|
||||
module_model_list.append(cls)
|
||||
if not cls._custom:
|
||||
module_model_list.append(cls)
|
||||
|
||||
# Since we don't return an instance here, the __init__
|
||||
# method won't be called.
|
||||
|
|
Loading…
Reference in New Issue