diff --git a/doc/reference/views.rst b/doc/reference/views.rst index 841900917d2..5bae6be941c 100644 --- a/doc/reference/views.rst +++ b/doc/reference/views.rst @@ -1174,6 +1174,266 @@ sorted on the string of the field. graph view aggregations are performed on database content, non-stored function fields can not be used in graph views +.. _reference/views/grid: + +Grid +---- + +.. raw:: html + + Enterprise feature + +Limitations +~~~~~~~~~~~ + +This view is a work in progress and may have to be expanded or altered. + +* only ``date`` column fields have been tested, ``selection`` and ``many2one`` + are nominally implemented and supported but have not been tested, + ``datetime`` is not implemented at all. +* column cells are hardly configurable and must be numerical +* cell adjustment is disabled by default and must be configured to be enabled +* ``create``, ``edit`` and ``delete`` ACL metadata doesn't get automatically + set on the view root due to limitations in ``fields_view_get`` + post-processing (there's a fixed explicit list of the view types getting + those attributes) + +Schema +~~~~~~ + +The grid view has its own schema and additional validation in this module. The +view architecture is: + +```` (1) + architecture root element + + * mandatory ``string`` attribute + * optional ``create``, ``edit`` and ``delete`` attributes + * optional ``adjustment`` and ``adjust_name`` attributes + + ``adjustment`` can be either ``object`` or ``action`` to indicate + whether a cell's adjustment should be performed through a method call + or an action execution. ``adjust_name`` provides respectively the method + name and the action id. + + In both cases, the adjustment parameters are provided as a + ``grid_adjust`` context member, in the ``object`` case, the parameters + are also provided as positional function parameters (next to an empty + list of ids): + + ``row_domain`` + the domain matching the entire row of the adjusted cell + ``column_field`` + the name of the column for the adjusted cell + ``column_value`` + the value of the column for the adjusted cell + ``cell_field`` + the measure field of the adjusted cell + ``change`` + the difference between the old value of the cell and the adjusted one, + may be possitive or negative + + * optional ``hide_line_total`` and ``hide_column_total`` attributes + + ``hide_line_total`` + set to true to hide total line (default false) + ``hide_column_total`` + set to true to hide total column (default false) + + * optional ``barchart_total`` attribute + + ``barchart_total`` + set to ``true`` in order to display a bar chart at the bottom of the grid, based on + the totals of the columns (default false). + + * optional ``create_inline`` and ``display_empty`` attributes + + ``create_inline`` + set to ``true`` in order to display an additional row at bottom of the grid with an + ``Add a line`` button (default false). When this option is set to ``true``, the ``Add a line`` button + from the control panel is hidden. When no data is available and when ``display_empty`` is + not set (so when the help content is displayed), the the ``Add a line`` button from the + control panel is shown in order to let the user create a first record. + ``display_empty`` + set to ``true`` in order to keep displaying the grid when there is no data (default false). This can + be useful when you want the user to be able to keep track of the current period (as dates + are displayed in the columns headers). As a reminder, when no data are present and when this + attribute is no set, the help content is displayed instead of the grid. + +``