diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index fabb8503b34..f1c99512118 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -2850,6 +2850,9 @@ .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_datetime input.oe_datepicker_master, .openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_date input.oe_datepicker_master { width: 100% !important; } +.openerp .oe_list.oe_list_editable.oe_editing .oe_form_field.oe_form_field_reference { + display: table; +} .openerp .oe_list_group_name { white-space: nowrap; } diff --git a/addons/web/static/src/css/base.sass b/addons/web/static/src/css/base.sass index c54cd2920c0..28947b3b467 100644 --- a/addons/web/static/src/css/base.sass +++ b/addons/web/static/src/css/base.sass @@ -2243,6 +2243,8 @@ $sheet-padding: 16px &.oe_form_field_datetime,&.oe_form_field_date input.oe_datepicker_master width: 100% !important + &.oe_form_field_reference + display: table .oe_list_group_name white-space: nowrap // }}} diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index ad48a8af1ef..f3ecc373ca5 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1022,7 +1022,7 @@ instance.web.ListView.List = instance.web.Class.extend( /** @lends instance.web. id = parseInt(ref_match[2], 10); new instance.web.DataSet(this.view, model).name_get([id]).done(function(names) { if (!names.length) { return; } - record.set(column.id, names[0][1]); + record.set(column.id + '__display', names[0][1]); }); } } else if (column.type === 'many2one') { @@ -2095,6 +2095,7 @@ instance.web.list.columns = new instance.web.Registry({ 'field.handle': 'instance.web.list.Handle', 'button': 'instance.web.list.Button', 'field.many2onebutton': 'instance.web.list.Many2OneButton', + 'field.reference': 'instance.web.list.Reference', 'field.many2many': 'instance.web.list.Many2Many' }); instance.web.list.columns.for_ = function (id, field, node) { @@ -2307,5 +2308,18 @@ instance.web.list.Many2Many = instance.web.list.Column.extend({ return this._super(row_data, options); } }); +instance.web.list.Reference = instance.web.list.Column.extend({ + _format: function (row_data, options) { + if (!_.isEmpty(row_data[this.id].value)) { + // If value, use __display version for printing + if (!!row_data[this.id + '__display']) { + row_data[this.id] = row_data[this.id + '__display']; + } else { + row_data[this.id] = {'value': ''}; + } + } + return this._super(row_data, options); + } +}); }; // vim:et fdc=0 fdl=0 foldnestmax=3 fdm=syntax: