diff options
| author | Michael Mattiello (mcm) <mcm@odoo.com> | 2020-06-03 07:54:11 +0000 |
|---|---|---|
| committer | Michael Mattiello (mcm) <mcm@odoo.com> | 2020-06-04 06:02:32 +0000 |
| commit | b7840dde39d0f004c8a4f9d8f0f058d756650554 (patch) | |
| tree | cda65028642f2ee61d334ab0781ea15e7767307f /addons/web/static/src/js/views | |
| parent | 3b59efa6142cf1da810d77728e3e5054b0846a06 (diff) | |
[IMP] web: add nolabel to list view
This commit adds the support of nolabel attribute on fields
in list view. This attribute can be used to empty the column header.
Example of use:
<record id="module_example_tree_view" model="ir.ui.view">
<field name="name">module.example.tree.opportunity</field>
<field name="model">module.example</field>
<field name="arch" type="xml">
<tree>
<field name="name"/>
<field name="tag_ids" widget="many2many_tags" nolabel="1"/>
</tree>
</field>
</record>
Result:
This will create a tree view with 2 columns.
The second column will have an empty header and won't be sortable.
Name |
--------+--------------
Record1 | [tag1]
Record2 | [tag1][tag2]
Record3 | [tag2]
closes odoo/odoo#52302
Task: 2269315
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Diffstat (limited to 'addons/web/static/src/js/views')
| -rw-r--r-- | addons/web/static/src/js/views/list/list_renderer.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/js/views/list/list_renderer.js index fc026a332f0..42b31bc2e3c 100644 --- a/addons/web/static/src/js/views/list/list_renderer.js +++ b/addons/web/static/src/js/views/list/list_renderer.js @@ -848,8 +848,8 @@ var ListRenderer = BasicRenderer.extend({ }, /** * Render a single <th> with the informations for a column. If it is not a - * field, the th will be empty. Otherwise, it will contains all relevant - * information for the field. + * field or nolabel attribute is set to "1", the th will be empty. + * Otherwise, it will contains all relevant information for the field. * * @private * @param {Object} node @@ -874,7 +874,7 @@ var ListRenderer = BasicRenderer.extend({ if (node.attrs.readOnly) { $th.addClass('oe_read_only'); } - if (!field) { + if (!field || node.attrs.nolabel === '1') { return $th; } var description = string || field.string; |
