summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-08-16 12:03:37 +0000
committerAaron Bohy <aab@odoo.com>2019-08-23 06:28:34 +0000
commitb2c09b4d3d971922c37965bae21c875585ea68bf (patch)
tree6d48cde57313550609b2220092af9cf18fb5f176 /addons/web/static/src
parentbf3c1d3e0c2cb9f6ed560994d24de026c080aa01 (diff)
[FIX] web: list: determine width according to widget
On a list with no data, the width of each column is determined by a heuristic. Before this rev., the heuristic was based on the field type. It now takes the potential widget set in the arch into account, and fallbacks on the field type.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js26
1 files changed, 14 insertions, 12 deletions
diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js
index 9275d414578..093b419b18d 100644
--- a/addons/web/static/src/js/views/list/list_editable_renderer.js
+++ b/addons/web/static/src/js/views/list/list_editable_renderer.js
@@ -566,19 +566,21 @@ ListRenderer.include({
// width.
return 1;
}
- var widget = this.state.fieldsInfo.list[column.attrs.name].Widget.prototype;
- if ('widthFactor' in widget) {
- return widget.widthFactor;
- }
- switch (field.type) {
- case 'boolean': return '40px';
- case 'date': return '92px';
- case 'datetime': return '146px';
- case 'float': return '92px';
- case 'integer': return '74px';
- case 'monetary': return '104px';
- default: return 1; // evenly distribute the remaining space
+ var widgetProto = this.state.fieldsInfo.list[column.attrs.name].Widget.prototype;
+ if ('widthFactor' in widgetProto) {
+ return widgetProto.widthFactor;
}
+ var fixedWidthTypes = {
+ boolean: '40px',
+ date: '92px',
+ datetime: '146px',
+ float: '92px',
+ integer: '74px',
+ monetary: '104px',
+ };
+ var widget = this.state.fieldsInfo.list[column.attrs.name].widget;
+ var type = widget in fixedWidthTypes ? widget : field.type;
+ return fixedWidthTypes[type] || 1;
},
/**
*