summaryrefslogtreecommitdiff
path: root/doc/reference
diff options
context:
space:
mode:
authorMartin Geubelle <mge@odoo.com>2019-03-13 16:40:08 +0000
committerAaron Bohy <aab@odoo.com>2019-04-02 11:55:57 +0000
commit015958dc1730296e216a035f3b12b92df2dbd6c8 (patch)
tree1499283c74febf9d360777b8a3cfc4c733ac1089 /doc/reference
parent2be28d4d033b5930e5a16ff02407315a116e9043 (diff)
[IMP] web,base: put buttons in list group headers
It is now possible to put buttons in the list view group headers. When the view is grouped by a many2one field, those buttons appear next to the header title when the group is opened. The buttons are specified in the views in a <groupby> tag in the list arch, with the following structure: <groupby name="groupedField"> <!-- must be a many2one --> <button type="object" name="my_method" string="Button1"/> </groupby> It is also possible to add `field`, inside the `groupby` which can be used for modifiers. These fields thus belong on the many2one comodel, like: <groupby name="partner_id"> <field name="name"/> <!-- name of partner_id --> <button type="object" name="my_method" string="Button1" attrs="{'invisible': [('name', '=', 'Georges')]}"/> </groupby> These extra fields are fetched in batch when grouping on the field. Part of task 1915702
Diffstat (limited to 'doc/reference')
-rw-r--r--doc/reference/views.rst21
1 files changed, 21 insertions, 0 deletions
diff --git a/doc/reference/views.rst b/doc/reference/views.rst
index b7d4ccec0f6..51f06877da9 100644
--- a/doc/reference/views.rst
+++ b/doc/reference/views.rst
@@ -333,6 +333,27 @@ Possible children elements of the list view are:
:ref:`form view <reference/views/form>` is also valid and will
be used when setting up the inline form view
+``groupby``
+ defines custom headers (with buttons) for the current view when grouping
+ records on many2one fields. It is also possible to add `field`, inside the
+ `groupby` which can be used for modifiers. These fields thus belong on the
+ many2one comodel. These extra fields will be fetched in batch.
+
+ ``name``
+ the name of a many2one field (on the current model). Custom header will be
+ displayed when grouping the view on this field name (only for first level).
+
+ .. code-block:: xml
+
+ <groupby name="partner_id">
+ <field name="name"/> <!-- name of partner_id -->
+ <button type="edit" name"edit" string="Edit/>
+ <button type="object" name="my_method" string="Button1"
+ attrs="{'invisible': [('name', '=', 'Georges')]}"/>
+ </groupby>
+
+ A special button (`type="edit"`) can be defined to open the many2one form view.
+
``control``
defines custom controls for the current view.