summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2012-02-08 14:06:51 +0100
committerXavier Morel <xmo@openerp.com>2012-02-08 14:06:51 +0100
commitf70b73f2442434f863e6825896a856f903d2c3df (patch)
tree385b2417317287b6ac3e0132f4a03b5f7b793265 /addons/web/static/src/js
parentf5ee468ca5d6936688f8e8ae18a31ba65c8730ca (diff)
[FIX] get_any with inheritance
bzr revid: xmo@openerp.com-20120208130651-7mdv7p1qcfgxczon
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/core.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/addons/web/static/src/js/core.js b/addons/web/static/src/js/core.js
index 45e682d8bdf..887d57bd747 100644
--- a/addons/web/static/src/js/core.js
+++ b/addons/web/static/src/js/core.js
@@ -291,6 +291,21 @@ openerp.web.Registry = openerp.web.Class.extend( /** @lends openerp.web.Registry
return object_match;
},
/**
+ * Checks if the registry contains an object mapping for this key.
+ *
+ * @param {String} key key to look for
+ */
+ contains: function (key) {
+ if (key === undefined) { return false; }
+ if (key in this.map) {
+ return true
+ }
+ if (this.parent) {
+ return this.parent.contains(key);
+ }
+ return false;
+ },
+ /**
* Tries a number of keys, and returns the first object matching one of
* the keys.
*
@@ -303,7 +318,7 @@ openerp.web.Registry = openerp.web.Class.extend( /** @lends openerp.web.Registry
get_any: function (keys) {
for (var i=0; i<keys.length; ++i) {
var key = keys[i];
- if (key === undefined || !(key in this.map)) {
+ if (!this.contains(key)) {
continue;
}