diff options
| author | Mathieu Duckerts-Antoine <dam@odoo.com> | 2020-04-28 12:43:30 +0000 |
|---|---|---|
| committer | Mathieu Duckerts-Antoine <dam@odoo.com> | 2020-05-05 19:23:20 +0000 |
| commit | 2c102c292f22f5d400d8caf779428fdc55c15e43 (patch) | |
| tree | 6436980060455bd35619672d5e0ba693551e3902 /addons/web/static/src/xml | |
| parent | c19dcf3983c797d82cd808d9701e190aee619af2 (diff) | |
[IMP] web: search panel counter changes
This commit introduces several changes in the search panel with
respect to record counts:
- the record counts are now also available for
the fields with select="one" attribute
(if not disabled explicitely).
- the record counts are better computed using the idea that
selected values within a group should not impact the counts
for the group values but only the counts for the other
group values.
On the way we have changed two keys in the values returned
by the server:
- 'count' becomes '__count'.
It has been done to avoid a possible clash in case a model would
have a field named 'count' and that the field values would be
wanted for some reason.
- 'name' (multi case) becomes 'display_name'.
It has been done in order to make the select one and multi cases
more similar and factorize some code.
TASK-ID: 2166814
Co-authored-by: Raphaël Collet <rco@openerp.com>
Co-authored-by: Mathieu Duckerts-Antoine <dam@odoo.com>
Co-authored-by: Alexis Lacroix <laa@odoo.com>
Co-authored-by: Julien Mougenot <jum@odoo.com>
Diffstat (limited to 'addons/web/static/src/xml')
| -rw-r--r-- | addons/web/static/src/xml/kanban.xml | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/addons/web/static/src/xml/kanban.xml b/addons/web/static/src/xml/kanban.xml index cb34cd16851..970f9fd9825 100644 --- a/addons/web/static/src/xml/kanban.xml +++ b/addons/web/static/src/xml/kanban.xml @@ -245,10 +245,14 @@ <t t-set="value" t-value="category.values[valueId]"/> <li class="o_search_panel_category_value border-0 list-group-item" t-att-data-id="value.id" t-att-data-category-id="category.id"> <header t-att-class="'list-group-item-action' + (value.id === category.activeValueId ? ' active' : '')"> - <label t-att-for="value.display_name" class="o_search_panel_label mb0"> + <label t-att-for="value.display_name" t-attf-class="o_search_panel_label mb0{{ category.disableCounters ? '' : ' o_with_counters' }}"> <span class="o_search_panel_label_title"><t t-esc="value.display_name"/></span> - <i t-if="value.childrenIds.length" t-attf-class="fa fa-fw o_toggle_fold {{value.folded ? 'fa-caret-left' : 'fa-caret-down'}}"/> + <i t-if="value.childrenIds.length" t-attf-class="o_toggle_fold fa fa-fw fa-caret-{{ value.folded ? 'right' : 'down' }}"/> </label> + <span t-if="!category.disableCounters and value.__count > 0" + class="text-muted ml-2 small" + t-esc="value.__count" + /> </header> <ul t-if="!value.folded" class="list-group d-block"> <t t-call="SearchPanel.CategoryValues"> @@ -285,10 +289,12 @@ <div class="custom-control custom-checkbox"> <t t-set="inputId" t-value="_.uniqueId('input_')"/> <input type="checkbox" t-att-id="inputId" t-att-checked="group.state === 'checked' ? 'checked' : undefined" class="custom-control-input"/> - <label t-att-for="inputId" class="o_search_panel_label custom-control-label d-block" t-att-title="group.tooltip"> - <i t-att-class="'fa fa-fw pull-right o_toggle_fold ' + (group.folded ? 'fa-caret-left' : 'fa-caret-down')"/> - <span t-if="group.hex_color" t-att-style="'color: ' + group.hex_color + ';'">●</span> - <span class="o_search_panel_label_title"><t t-esc="group.name"/></span> + <label t-att-for="inputId" t-attf-class="o_search_panel_label custom-control-label{{ group.disableCounters ? '' : ' o_with_counters' }}" t-att-title="group.tooltip"> + <span class="o_search_panel_label_title"> + <span t-if="group.hex_color" t-attf-style="color: {{ group.hex_color }};">●</span> + <t t-esc="group.name"/> + </span> + <i t-attf-class="o_toggle_fold fa fa-fw fa-caret-{{ group.folded ? 'right' : 'down' }}"/> </label> </div> <ul t-if="!group.folded" class="list-group d-block"> @@ -313,10 +319,12 @@ <div class="custom-control custom-checkbox"> <t t-set="inputId" t-value="_.uniqueId('input_')"/> <input type="checkbox" t-att-id="inputId" t-att-checked="value.checked ? 'checked' : undefined" class="custom-control-input"/> - <label t-att-for="inputId" class="o_search_panel_label custom-control-label d-block" t-att-title="group && group.tooltip"> - <span class="o_search_panel_label_title"><t t-esc="value.name"/></span> - <span t-if="value.count > 0" class="pull-right text-muted mr-2 mt-1 small"><t t-esc="value.count"/></span> - <span t-if="filter.disableCounters" class="pull-right text-muted mr-2 mt-1 small">?</span> + <label t-att-for="inputId" class="o_search_panel_label custom-control-label" t-att-title="group && group.tooltip"> + <span class="o_search_panel_label_title" t-esc="value.display_name"/> + <span t-if="!filter.disableCounters and value.__count > 0" + class="text-muted ml-2 small" + t-esc="value.__count" + /> </label> </div> </li> |
