From 0cf516f860aec626b644dd9f10a33a83086375f2 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Wed, 17 Jun 2015 18:17:43 +0200 Subject: [PATCH] git commit -a -m "[FIX] web: relational widgets Traceback when save a record (e.g.: event.event) when edit and save a created one2many's record in form view (e.g.: event.question), if a one2many line are created previously inside the modal form view (e.g.: event.answer). Wrong check in _on_load_record to don't set starting_ids for created record --- addons/web/static/src/js/views/form_relational_widgets.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/addons/web/static/src/js/views/form_relational_widgets.js b/addons/web/static/src/js/views/form_relational_widgets.js index f2e3d77fff4..4fdedc426bc 100644 --- a/addons/web/static/src/js/views/form_relational_widgets.js +++ b/addons/web/static/src/js/views/form_relational_widgets.js @@ -525,7 +525,11 @@ var AbstractManyField = common.AbstractField.extend({ }, _on_load_record: function (record) { - this.starting_ids = record.id ? record[this.name].slice() : []; + this.starting_ids = []; + // don't set starting_ids for the new record + if (record.id && (!isNaN(record.id) || record.id.indexOf(this.dataset.virtual_id_prefix) === -1)) { + this.starting_ids = record[this.name].slice(); + } }, set_value: function(ids) {