diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-05-04 16:10:50 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-05-04 16:10:50 +0200 |
| commit | ac63dfc8f48fa6451b4ef94e24e784f252b84f8e (patch) | |
| tree | 768b741e1a34a94b95977d8ff869143aab73617e /addons/web/static/src/js/views/form | |
| parent | 62705aee69460457c1b9257ac30363754c60c973 (diff) | |
| parent | 8dade01e2c5b560864291fb3c437ccf5999aee12 (diff) | |
[MERGE] forward port branch 11.0 up to 8dade01e2c5
Diffstat (limited to 'addons/web/static/src/js/views/form')
| -rw-r--r-- | addons/web/static/src/js/views/form/form_controller.js | 10 | ||||
| -rw-r--r-- | addons/web/static/src/js/views/form/form_view.js | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/js/views/form/form_controller.js index 4c73fde121b..2cc52e4937b 100644 --- a/addons/web/static/src/js/views/form/form_controller.js +++ b/addons/web/static/src/js/views/form/form_controller.js @@ -214,6 +214,16 @@ var FormController = BasicController.extend({ return changedFields; }); }, + /** + * Overrides to force the viewType to 'form', so that we ensure that the + * correct fields are reloaded (this is only useful for one2many form views). + * + * @override + */ + update: function (params, options) { + params = _.extend({viewType: 'form'}, params); + return this._super(params, options); + }, //-------------------------------------------------------------------------- // Private diff --git a/addons/web/static/src/js/views/form/form_view.js b/addons/web/static/src/js/views/form/form_view.js index 10fc9a12b20..d8693586590 100644 --- a/addons/web/static/src/js/views/form/form_view.js +++ b/addons/web/static/src/js/views/form/form_view.js @@ -73,6 +73,14 @@ var FormView = BasicView.extend({ _.each(this.loadParams.fieldsInfo.form, function (attrs, fieldName) { var field = fields[fieldName]; + if (!field) { + // when a one2many record is opened in a form view, the fields + // of the main one2many view (list or kanban) are added to the + // fieldsInfo of its form view, but those fields aren't in the + // loadParams.fields, as they are not displayed in the view, so + // we can ignore them. + return; + } if (field.type !== 'one2many' && field.type !== 'many2many') { return; } |
