summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Trigaux <mart-e@users.noreply.github.com>2014-05-27 16:37:10 +0200
committerMartin Trigaux <mart-e@users.noreply.github.com>2014-05-27 16:37:10 +0200
commitaeaa826d2f29aa6dadb65051a2db1652fa87e3b7 (patch)
tree2e4253ce491af894a9a6ddfb50aa7da6752b9a19
parent14c300bdbd57ea91a7f36b7a43c30afc310253a4 (diff)
parent26cb2089032af0f11578f1997544ff1deef1e25e (diff)
Merge pull request #221 from odoo-dev/7.0-o2m-duplication-issue-msh
[FIX] Fix o2m record duplication when clicking on a button The button action will execute a write call, creating the new line. The reload is necessary to avoid recreating the line when using the save button.
-rw-r--r--addons/web/static/src/js/view_form.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web/static/src/js/view_form.js b/addons/web/static/src/js/view_form.js
index 7a38f0be2be..ce4246708b4 100644
--- a/addons/web/static/src/js/view_form.js
+++ b/addons/web/static/src/js/view_form.js
@@ -3948,7 +3948,11 @@ instance.web.form.One2ManyListView = instance.web.ListView.extend({
else
return $.when();
}).done(function () {
- if (!self.o2m.options.reload_on_button) {
+ var ds = self.o2m.dataset;
+ var cached_records = _.any([ds.to_create, ds.to_delete, ds.to_write], function(value) {
+ return value.length;
+ });
+ if (!self.o2m.options.reload_on_button && !cached_records) {
self.handle_button(name, id, callback);
}else {
self.handle_button(name, id, function(){