summaryrefslogtreecommitdiff
path: root/addons/google_docs/static/src/js/gdocs.js
diff options
context:
space:
mode:
authorHarry (OpenERP) <hmo@tinyerp.com>2012-10-17 12:19:06 +0530
committerHarry (OpenERP) <hmo@tinyerp.com>2012-10-17 12:19:06 +0530
commit2c687af6870b6020308387851d7473f181559833 (patch)
tree32a9e340a79d24f060edc3de226ffaa2875a4805 /addons/google_docs/static/src/js/gdocs.js
parent067fa7fe7cd631a4cb50d494c7d99c050dd7fd28 (diff)
parent7368b52a95524897be9bc511035ad5a6ba28c3e4 (diff)
[MERGE]
bzr revid: hmo@tinyerp.com-20121017064906-ns8rk3hfjanznwco
Diffstat (limited to 'addons/google_docs/static/src/js/gdocs.js')
-rw-r--r--addons/google_docs/static/src/js/gdocs.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/addons/google_docs/static/src/js/gdocs.js b/addons/google_docs/static/src/js/gdocs.js
index ac19e4cc6e7..fb9e95c0b63 100644
--- a/addons/google_docs/static/src/js/gdocs.js
+++ b/addons/google_docs/static/src/js/gdocs.js
@@ -1,21 +1,25 @@
openerp.google_docs = function(instance, m) {
var QWeb = instance.web.qweb,
_t = instance.web._t;
-
+//{}
instance.web.Sidebar = instance.web.Sidebar.extend({
-
- on_attachments_loaded: function(attachments) {
+ on_attachments_loaded: function(attachments) {
var self = this;
_.chain(attachments)
- .filter(function(attachment){ if (attachment.name ==='Google Doc') return true})
- .map(function(attachment, i){ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)})
+ .groupBy(function(attachment) { return attachment.name})
+ .each(function(attachment){
+ if(attachment.length > 1)
+ _.map(attachment, function(attachment, i){
+ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)
+ })
+ })
self._super(attachments);
- },
- redraw: function() {
- var self = this;
- this._super.apply(this, arguments);
- self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('Google_doc', {widget: self}))
- self.$el.find('.oe_sidebar_add_google_doc').on('click', function (e) {
+ },
+ redraw: function() {
+ var self = this;
+ this._super.apply(this, arguments);
+ self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('Google_doc', {widget: self}))
+ self.$el.find('.oe_sidebar_add_google_doc').on('click', function (e) {
self.on_google_doc();
});
},