From 99c6701ba55576f0bc0cf2ad03d27cafa1f8a2c3 Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Wed, 17 Oct 2012 12:40:08 +0530 Subject: [IMP] document: display name with number if more than one attachment has same number bzr revid: hmo@tinyerp.com-20121017071008-1khlntrrdi7cxgao --- addons/document/static/src/js/document.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'addons/document/static/src/js') diff --git a/addons/document/static/src/js/document.js b/addons/document/static/src/js/document.js index 2dde2696c81..e4bce2da76e 100644 --- a/addons/document/static/src/js/document.js +++ b/addons/document/static/src/js/document.js @@ -5,6 +5,19 @@ openerp.document = function (instance) { this._super.apply(this, arguments); this.sections.splice(1, 0, { 'name' : 'files', 'label' : _t('Attachment(s)'), }); this.items['files'] = []; - } + }, + on_attachments_loaded: function(attachments) { + //to display number in name if more then one attachment which has same name. + var self = this; + _.chain(attachments) + .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); + }, }); -}; \ No newline at end of file +}; -- cgit v1.2.3 From bef70dd63854791f3137ae4908f18889543c6f33 Mon Sep 17 00:00:00 2001 From: Tejas Tank Date: Thu, 25 Oct 2012 13:08:34 +0530 Subject: [FIX] Document name and google doc index. bzr revid: tta@openerp.com-20121025073834-0tcjrqe8p7n3m2yx --- addons/document/static/src/js/document.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'addons/document/static/src/js') diff --git a/addons/document/static/src/js/document.js b/addons/document/static/src/js/document.js index e4bce2da76e..23f1375e8c8 100644 --- a/addons/document/static/src/js/document.js +++ b/addons/document/static/src/js/document.js @@ -9,7 +9,7 @@ openerp.document = function (instance) { on_attachments_loaded: function(attachments) { //to display number in name if more then one attachment which has same name. var self = this; - _.chain(attachments) + _.chain(attachments.reverse()) .groupBy(function(attachment) { return attachment.name}) .each(function(attachment){ if(attachment.length > 1) -- cgit v1.2.3