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 3dcda5e5c08..adf5f2b4422 100644 --- a/addons/web/static/src/js/view_form.js +++ b/addons/web/static/src/js/view_form.js @@ -1176,6 +1176,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.form_template = "WidgetParagraph"; this.colspan = parseInt(this.node.attrs.colspan || 1, 10); @@ -1184,6 +1189,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 279c3affa5c..eec5ef77bd3 100644 --- a/addons/web/static/src/xml/base.xml +++ b/addons/web/static/src/xml/base.xml @@ -927,7 +927,7 @@ -

+