[IMP] counter should be apply on multiple section with same name attribute

bzr revid: rgaopenerp-20121016114259-9g496xqj8ldal1vk
This commit is contained in:
RGA(OpenERP) 2012-10-16 17:12:59 +05:30
parent 9932152fae
commit 7368b52a95
1 changed files with 8 additions and 3 deletions

View File

@ -1,13 +1,18 @@
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) {
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() {