summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2015-04-16 12:42:58 +0200
committerChristophe Matthieu <chm@odoo.com>2015-04-16 12:52:48 +0200
commite6fdfaf23191cb54785a7eeade46be78159921e4 (patch)
tree53c18d7b19c8708b2a418ca0d879e9b6af8f155d /addons/web/static/src
parent6a11f594a872aecd8888a15075e66f76acf33fd5 (diff)
[FIX] web: on2many editable list: remove hanlder to relad the view because no need (the deferred are good). Reset the dataset in set_value because on change send a list of command with all values (link, update, created). Link id into the dataset when update cammand if needed.
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/form_relational_widgets.js12
1 files changed, 6 insertions, 6 deletions
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 17f6cd842c9..89653bf420f 100644
--- a/addons/web/static/src/js/views/form_relational_widgets.js
+++ b/addons/web/static/src/js/views/form_relational_widgets.js
@@ -532,6 +532,7 @@ var AbstractManyField = common.AbstractField.extend({
throw new Error("set_value of '"+this.name+"' must receive an list of ids without virtual ids.", ids);
}
if (_.find(ids, function(id) { return typeof(id) !== "number"; } )) {
+ this.dataset.reset_ids([]);
return this.send_commands(ids);
}
this.dataset.reset_ids(ids);
@@ -638,7 +639,11 @@ var AbstractManyField = common.AbstractField.extend({
res = id;
});
case COMMANDS.UPDATE:
- return dataset.write(command[1], command[2], options);
+ return dataset.write(command[1], command[2], options).then(function (id) {
+ if (dataset.ids.indexOf(command[1]) === -1) { // on change can send an update command without a previous link
+ dataset.ids.push(command[1]);
+ }
+ });
case COMMANDS.DELETE:
return dataset.unlink(command[1]);
case COMMANDS.LINK_TO:
@@ -727,11 +732,6 @@ var FieldOne2Many = AbstractManyField.extend({
this.initial_is_loaded = this.is_loaded;
this.is_started = false;
this.set_value([]);
- this.on('change:commands', this, function () {
- if (this.is_started && !this.no_rerender) {
- this.reload_current_view();
- }
- });
},
start: function() {
this._super.apply(this, arguments);