summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/transcoder.js
diff options
context:
space:
mode:
authorRaphael Collet <rco@openerp.com>2016-02-09 10:01:34 +0100
committerRaphael Collet <rco@openerp.com>2016-02-09 10:01:43 +0100
commit5763c32a6dd558f65864c661a7c3d068f012df27 (patch)
treea19a13388bea846f42ea810810e87a9c31f98503 /addons/web_editor/static/src/js/transcoder.js
parentd82e489add442f0bef52b58620c8d7988919872d (diff)
[FIX] addons: fix usage of decorators `api.v7`/`api.v8`
Specifically, when one API implementation calls the other one, it has to call the method *from the same class*. Otherwise, overriding the method may result in an infinite recursion. Consider: class A(Model): _name = 'stuff' @api.v8 def foo(self): return 42 @api.v7 def foo(self, cr, uid, context=None): return self.browse(cr, uid, [], context).foo() class B(Model): _inherit = 'stuff' def foo(self, cr, uid, context=None): return super(B, self).foo(cr, uid, context=context) + 1 and now call: `env['stuff'].foo()`. This invokes `B.foo` (new-API), which calls `B.foo` (old-API), which calls `A.foo` (old-API), which calls `B.foo` (new-API) instead of `A.foo`! This issue would not be present if old-API `A.foo` was defined as: @api.v7 def foo(self, cr, uid, context=None): return A.foo(self.browse(cr, uid, [], context))
Diffstat (limited to 'addons/web_editor/static/src/js/transcoder.js')
0 files changed, 0 insertions, 0 deletions