diff options
| author | Géry Debongnie <ged@odoo.com> | 2017-09-13 11:48:02 +0200 |
|---|---|---|
| committer | Géry Debongnie <ged@odoo.com> | 2017-09-13 14:04:34 +0200 |
| commit | 93cf24f73ae79cdfd0346145d0b828ebd1ea07f9 (patch) | |
| tree | 25092bf66b9ab6ff1a8ff4b424aca75db7ca0537 /addons/web/static/src/js/views/form | |
| parent | c1fa3b8ab3dfa1306dbdd3b6dc910405a3357d16 (diff) | |
[FIX] web: reimplement custom widgets in basic views
With the new views, we lost a (almost unused and undocumented) feature:
the ability to instantiate custom widgets in a form view, not linked to
a particular field. For example:
<widget type="weekly_timesheet" attrs="{'readonly': [['state', 'not in', ['new', 'draft']]]}"/>
We reintroduce this feature in this commit, with a nice twist: it also
works for the list view and the kanban view.
Diffstat (limited to 'addons/web/static/src/js/views/form')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_renderer.js | 23 |
1 files changed, 10 insertions, 13 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 3cb22af5dfd..7d962e223ce 100644 --- a/addons/web/static/src/js/views/form/form_renderer.js +++ b/addons/web/static/src/js/views/form/form_renderer.js @@ -227,19 +227,6 @@ var FormRenderer = BasicRenderer.extend({ }, /** * @private - * @param {jQueryElement} $el - * @param {Object} node - */ - _handleAttributes: function ($el, node) { - if (node.attrs.class) { - $el.addClass(node.attrs.class); - } - if (node.attrs.style) { - $el.attr('style', node.attrs.style); - } - }, - /** - * @private * @param {Object} node * @returns {jQueryElement} */ @@ -759,6 +746,16 @@ var FormRenderer = BasicRenderer.extend({ return $sheet; }, /** + * Instantiate custom widgets + * + * @private + * @param {Object} node + * @returns {jQueryElement} + */ + _renderTagWidget: function (node) { + return this._renderWidget(this.state, node); + }, + /** * Main entry point for the rendering. From here, we call _renderNode on * the root of the arch, then, when every deferred (from the field widgets) * are done, it will resolves itself. |
