[FIX] document: display Attachment(s) menu only on form view
authorSomesh Khare <skh@openerp.com>
Tue, 26 Aug 2014 06:25:23 +0000 (11:55 +0530)
committerMartin Trigaux <mat@openerp.com>
Thu, 4 Sep 2014 12:47:06 +0000 (14:47 +0200)
The attachment menu (list and add) has no effect in tree view (not supporting multi-items upload and display), the menu should then only be displayed in these view (opw 612534)

addons/document/static/src/js/document.js

index e4bce2d..5b353d5 100644 (file)
@@ -3,8 +3,10 @@ openerp.document = function (instance) {
     instance.web.Sidebar.include({
         init : function(){
             this._super.apply(this, arguments);
-            this.sections.splice(1, 0, { 'name' : 'files', 'label' : _t('Attachment(s)'), });
-            this.items['files'] = [];
+            if (this.getParent().view_type == "form"){
+                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.