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.
This commit is contained in:
Martin Trigaux 2014-05-27 16:37:10 +02:00
commit aeaa826d2f
1 changed files with 5 additions and 1 deletions

View File

@ -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(){