[ADD] pluck method to collection
authorXavier Morel <xmo@openerp.com>
Wed, 24 Aug 2011 12:21:24 +0000 (14:21 +0200)
committerXavier Morel <xmo@openerp.com>
Wed, 24 Aug 2011 12:21:24 +0000 (14:21 +0200)
bzr revid: xmo@openerp.com-20110824122124-xr4g92x6jlw85rbg

addons/base/static/src/js/list.js

index aa6f960..b84c286 100644 (file)
@@ -1437,6 +1437,11 @@ var Collection = openerp.base.Class.extend(/** @lends Collection# */{
         });
         return results;
     },
+    pluck: function (fieldname) {
+        return this.map(function (record) {
+            return record.get(fieldname);
+        });
+    },
     indexOf: function (record) {
         return _(this.records).indexOf(record);
     }