summaryrefslogtreecommitdiff
path: root/addons/document/static/src
diff options
context:
space:
mode:
authorDenis Ledoux dle@openerp.com <>2012-11-08 10:28:38 +0100
committerDenis Ledoux dle@openerp.com <>2012-11-08 10:28:38 +0100
commit981168dfc6d628c72d8469022c0b51e0f5ec00df (patch)
treee7497e1366dcd0b7759ed6eae9d2fa8b50ff46c5 /addons/document/static/src
parent9e56b3b6a8a761e02099146b338225d29dbc8c8a (diff)
parent29fffbc97d8970513114b7b76763f002aa73e395 (diff)
[ADD][MERGE]Add functionnalities, merge with trunk
bzr revid: dle@openerp.com-20121108092838-fe89ohg9za3ln6y1
Diffstat (limited to 'addons/document/static/src')
-rw-r--r--addons/document/static/src/js/document.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/addons/document/static/src/js/document.js b/addons/document/static/src/js/document.js
index 2dde2696c81..23f1375e8c8 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.reverse())
+ .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
+};