Don't convert ids for inherited methods for issue1776

This commit is contained in:
Cédric Krier
2010-12-27 17:00:48 +01:00
parent c1a67a61d7
commit fd1d0e77a5
2 changed files with 2 additions and 17 deletions
+1
View File
@@ -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
View File
@@ -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):