[FIX] update to latest version saas code with updated underscore lib
authorMartin Trigaux <mat@openerp.com>
Thu, 24 Apr 2014 16:08:33 +0000 (18:08 +0200)
committerMartin Trigaux <mat@openerp.com>
Thu, 24 Apr 2014 16:08:33 +0000 (18:08 +0200)
bzr revid: mat@openerp.com-20140424160833-p0uf6zzst0pnj3i7

addons/web/static/src/js/views.js

index 78aeb29..3e6bb08 100644 (file)
@@ -1348,13 +1348,12 @@ instance.web.View = instance.web.Widget.extend({
         var context = new instance.web.CompoundContext(dataset.get_context(), action_data.context || {});
         var handler = function (action) {
             if (action && action.constructor == Object) {
-                // filter out context keys that are specific to the action model.
-                // Wrong default_ and search_default values will no give the expected views
+                // filter out context keys that are specific to the current action.
+                // Wrong default_* and search_default_* values will no give the expected result
                 // Wrong group_by values will simply fail and forbid rendering of the destination view
-                var view_refs = _(action.views).map(function(view){return view[1] + '_view_ref';}).join('|');
                 var ncontext = new instance.web.CompoundContext(
-                    self.object(_.reject(self.pairs(dataset.get_context().eval()), function(pair) {
-                      return pair[0].match('^(?:(?:default_|search_default_)|(?:'+view_refs+')|group_by|group_by_no_leaf|active_id|active_ids)$') !== null;
+                    _.object(_.reject(_.pairs(dataset.get_context().eval()), function(pair) {
+                      return pair[0].match('^(?:(?:default_|search_default_).+|.+_view_ref|group_by|group_by_no_leaf|active_id|active_ids)$') !== null;
                     }))
                 );
                 ncontext.add(action_data.context || {});
@@ -1406,31 +1405,6 @@ instance.web.View = instance.web.Widget.extend({
             return dataset.exec_workflow(record_id, action_data.name).then(handler);
         }
     },
-    // Convert an object into a list of `[key, value]` pairs.
-    pairs: function(obj) {
-        var keys = _.keys(obj);
-        var length = keys.length;
-        var pairs = new Array(length);
-        for (var i = 0; i < length; i++) {
-          pairs[i] = [keys[i], obj[keys[i]]];
-        }
-        return pairs;
-    },
-    // Converts lists into objects. Pass either a single array of `[key, value]`
-    // pairs, or two parallel arrays of the same length -- one of keys, and one of
-    // the corresponding values.
-    object: function(list, values) {
-        if (list == null) return {};
-        var result = {};
-        for (var i = 0, length = list.length; i < length; i++) {
-          if (values) {
-            result[list[i]] = values[i];
-          } else {
-            result[list[i][0]] = list[i][1];
-          }
-        }
-        return result;
-    },
     /**
      * Directly set a view to use instead of calling fields_view_get. This method must
      * be called before start(). When an embedded view is set, underlying implementations