diff --git a/addons/web/static/src/css/base.css b/addons/web/static/src/css/base.css index ce86eb889ea..cc3dfaed81a 100644 --- a/addons/web/static/src/css/base.css +++ b/addons/web/static/src/css/base.css @@ -1307,6 +1307,10 @@ label.error { white-space: normal; } +.openerp .oe_forms .oe_form_paragraph.oe_multilines { + white-space: pre; +} + .openerp .oe_form_field_one2many .oe-actions h3.oe_view_title, .openerp .oe_form_field_one2many_list .oe-actions h3.oe_view_title{ display: inline; diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js index f4749717a6b..114d8a6a189 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1197,6 +1197,11 @@ openerp.web.form.WidgetLabel = openerp.web.form.Widget.extend({ this._super(view, node); + if (this.node.tag == 'label' && !this.string && this.node.children.length) { + this.string = this.node.children[0]; + this.align = 'left'; + } + if (this.node.tag == 'label' && (this.align === 'left' || this.node.attrs.colspan || (this.string && this.string.length > 32))) { this.template = "WidgetParagraph"; this.colspan = parseInt(this.node.attrs.colspan || 1, 10); @@ -1205,6 +1210,8 @@ openerp.web.form.WidgetLabel = openerp.web.form.Widget.extend({ if (isNaN(parseFloat(this.node.attrs.align))) { this.align = 'left'; } + + this.multilines = this.string && _.str.lines(this.string).length > 1; } else { this.colspan = 1; this.width = '1%'; diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/xml/base.xml index 69c491c73a5..c1fdb3b7c92 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -929,7 +929,7 @@ -

+