From b2c1d5ede2254e13bea32451faefa28a6eddcd4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Theys?= Date: Tue, 12 Jun 2018 16:05:18 +0200 Subject: [IMP] web: fix default sequence for list with handle The sequence had a static default value, but when there is an handle, it's important that new items are added at the top or the bottom of the list. This is a rare case where the defaul_get from the server will be ignored by the view for a certain field. This will work: - both in editable mode (inline) and in dialog mode, - both for X2Many and standalone list. --- addons/web/static/src/js/fields/relational_fields.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'addons/web/static/src/js/fields/relational_fields.js') diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/js/fields/relational_fields.js index 83ce59f1eb6..bf2c303a2bb 100644 --- a/addons/web/static/src/js/fields/relational_fields.js +++ b/addons/web/static/src/js/fields/relational_fields.js @@ -1293,12 +1293,14 @@ var FieldOne2Many = FieldX2Many.extend({ */ _onAddRecord: function (ev) { var self = this; + var data = ev.data || {}; + // we don't want interference with the components upstream. ev.stopPropagation(); if (this.editable) { if (!this.activeActions.create) { - if (ev.data.onFail) { - ev.data.onFail(); + if (data.onFail) { + data.onFail(); } } else if (!this.creatingRecord) { this.creatingRecord = true; -- cgit v1.2.3