diff options
| author | qsm-odoo <qsm@odoo.com> | 2017-05-11 11:06:37 +0200 |
|---|---|---|
| committer | qsm-odoo <qsm@odoo.com> | 2017-05-11 15:09:25 +0200 |
| commit | 40a026d5b22047ccfd246d53a42dc1e6b22f225d (patch) | |
| tree | 52071cbcb800653e7f490023f8cf42c15c3eafc2 /addons/web/static/src | |
| parent | 97517a1cc25998c7192ae93fe64caad2edf6fd4b (diff) | |
[FIX] web: implement <newline/> form tag behavior
Before this commit, the new form view implementation was rendering
<newline/> tags as real <newline/> DOM element. The wanted behavior
is now restored:
- As outer group direct child, produce a <br/> tag, forcing the next
group children to be on a new line
- As inner group direct child, produce nothing but forces the creation
of a new <tr/> (for the next group children)
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_renderer.js | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/js/views/form/form_renderer.js index b4576dffa38..6dc4d262022 100644 --- a/addons/web/static/src/js/views/form/form_renderer.js +++ b/addons/web/static/src/js/views/form/form_renderer.js @@ -315,9 +315,16 @@ var FormRenderer = BasicRenderer.extend({ $result.append($sep); } - var currentColspan = 0; var $currentRow = $('<tr/>'); + var currentColspan = 0; _.each(node.children, function (child) { + if (child.tag === 'newline') { + $currentRow.appendTo($result); + $currentRow = $('<tr/>'); + currentColspan = 0; + return; + } + var colspan = parseInt(child.attrs.colspan, 10); var isLabeledField = (child.tag === 'field' && child.attrs.nolabel !== '1'); if (!colspan) { @@ -524,6 +531,9 @@ var FormRenderer = BasicRenderer.extend({ var $result = $('<div/>', {class: 'o_group'}); var colSize = Math.max(1, Math.round(12 / (parseInt(node.attrs.col, 10) || 2))); $result.append(_.map(node.children, function (child) { + if (child.tag === 'newline') { + return $('<br/>'); + } var $child = self._renderNode(child); $child.addClass('o_group_col_' + (colSize * (parseInt(child.attrs.colspan, 10) || 1))); return $child; |
