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
This commit is contained in:
Christophe Matthieu
2015-06-17 18:17:43 +02:00
parent b026fe7611
commit 0cf516f860
@@ -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) {