From fe1a9ee4ec6d27b4c3aa3144bfd6f9846850f619 Mon Sep 17 00:00:00 2001 From: Xavier Morel Date: Mon, 27 Jun 2011 16:14:38 +0200 Subject: [PATCH] [IMP] in form view, try all widget possibilities in sequence, so that the form falls back on the default widget if it does not find a more precise spec bzr revid: xmo@openerp.com-20110627141438-r0gq292w7jp4s79n --- addons/base/static/src/js/chrome.js | 23 +++++++++++++++++++++++ addons/base/static/src/js/form.js | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/addons/base/static/src/js/chrome.js b/addons/base/static/src/js/chrome.js index b019d7f1867..556c715d339 100644 --- a/addons/base/static/src/js/chrome.js +++ b/addons/base/static/src/js/chrome.js @@ -137,6 +137,29 @@ openerp.base.Registry = Class.extend( /** @lends openerp.base.Registry# */ { } return object_match; }, + /** + * Tries a number of keys, and returns the first object matching one of + * the keys. + * + * @param {Array} keys a sequence of keys to fetch the object for + * @returns {Class} the first class found matching an object + * + * @throws {openerp.base.KeyNotFound} if none of the keys was in the mapping + * @trows {openerp.base.ObjectNotFound} if a found object path was invalid + */ + get_any: function (keys) { + for (var i=0; i