Don't convert ids for inherited methods for issue1776
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Model doesn't convert anymore ids for inherited methods
|
||||
* Remove required attribute on Boolean fields
|
||||
* Add One2One field
|
||||
* Add AUTOINCREMENT to sqlite primary key
|
||||
|
||||
+1
-17
@@ -107,23 +107,7 @@ class Model(object):
|
||||
model_obj = self.pool.get(model_name)
|
||||
if hasattr(model_obj, name) and \
|
||||
callable(getattr(model_obj, name)):
|
||||
def func(*args, **kwargs):
|
||||
if args:
|
||||
ids = args[0]
|
||||
int_id = False
|
||||
if isinstance(ids, (int, long)):
|
||||
int_id = True
|
||||
ids = [ids]
|
||||
if reduce(lambda x, y: x and
|
||||
isinstance(y, (int, long)), ids, True):
|
||||
# Replace ids by the parent ids
|
||||
ids = [getattr(x, field_name).id for x in
|
||||
self.browse(ids)]
|
||||
if int_id:
|
||||
ids = ids[0]
|
||||
args = tuple([ids] + list(args[1:]))
|
||||
return getattr(model_obj, name)(*args, **kwargs)
|
||||
return func
|
||||
return getattr(model_obj, name)
|
||||
raise AttributeError
|
||||
|
||||
def _inherits_reload(self):
|
||||
|
||||
Reference in New Issue
Block a user