[IMP] api: compute methods cannot depend on field 'id'
authorSamus CTO <cto@openerp.com>
Thu, 4 Sep 2014 07:30:43 +0000 (09:30 +0200)
committerRaphael Collet <rco@openerp.com>
Mon, 15 Sep 2014 13:06:44 +0000 (15:06 +0200)
This feature hasn't been implemented because of complexity problems.
Therefore, we should not allow the developer to use it.

openerp/api.py

index 83190f8..d576f9f 100644 (file)
@@ -191,6 +191,8 @@ def depends(*args):
     """
     if args and callable(args[0]):
         args = args[0]
+    elif any('id' in arg.split('.') for arg in args):
+        raise NotImplementedError("Compute method cannot depend on field 'id'.")
     return lambda method: decorate(method, '_depends', args)