summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/fields
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2018-06-12 16:05:18 +0200
committerSébastien Theys <seb@odoo.com>2018-06-29 10:39:42 +0200
commitb2c1d5ede2254e13bea32451faefa28a6eddcd4c (patch)
treee5621cacbda4541b9fe3c7ad114c47a8f5ac1bf1 /addons/web/static/src/js/fields
parent217fee2636fb4dc4c193e67e5727a9fcef200605 (diff)
[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.
Diffstat (limited to 'addons/web/static/src/js/fields')
-rw-r--r--addons/web/static/src/js/fields/relational_fields.js6
1 files changed, 4 insertions, 2 deletions
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;