[FIX] don't display add/remove buttons in group_by_no_leaf views
authorXavier Morel <xmo@openerp.com>
Wed, 14 Dec 2011 14:43:17 +0000 (15:43 +0100)
committerXavier Morel <xmo@openerp.com>
Wed, 14 Dec 2011 14:43:17 +0000 (15:43 +0100)
bzr revid: xmo@openerp.com-20111214144317-7k0u4s2xg9ochpte

addons/web/static/src/js/view_list.js
addons/web/static/src/xml/base.xml

index 059bc02..bf42343 100644 (file)
@@ -79,6 +79,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
             self.compute_aggregates();
         });
 
+        this.no_leaf = false;
     },
     /**
      * Retrieves the view's number of records per page (|| section)
@@ -473,6 +474,7 @@ openerp.web.ListView = openerp.web.View.extend( /** @lends openerp.web.ListView#
         if (_.isEmpty(group_by) && !context['group_by_no_leaf']) {
             group_by = null;
         }
+        this.no_leaf = !!context['group_by_no_leaf'];
 
         this.reload_view(!!group_by, context).then(
             $.proxy(this, 'reload_content'));
index a861c3c..cf517fe 100644 (file)
             <th t-att-colspan="columns_count">
                 <table>
                     <tr>
-                        <td t-if="options.action_buttons !== false" class="oe-actions">
+                        <td t-if="!no_leaf and options.action_buttons !== false" class="oe-actions">
                             <button type="button" class="oe-list-add"
                                     t-if="options.addable">
                                 <t t-esc="options.addable"/>
         this.prepend($title);
     </t>
 </t>
-<th t-name="Listview.navigation.button" t-if="options.pager !== false"
+<th t-name="Listview.navigation.button" t-if="!no_leaf and options.pager !== false"
         class="oe-list-pager" t-att-colspan="columns_count">
     <button type="button" disabled="disabled"
             data-pager-action="first">First</button>