Get ids for button later
As save is called by the button, the record id could change if the save is a creation so the list of ids must be constructed later.
This commit is contained in:
1 parent
2baa74f448
commit
0bef90bfd3
1 file changed
+5
-4
+5
-4
@@ -1255,6 +1255,7 @@
|
||||
return buttons;
|
||||
},
|
||||
button: function(attributes) {
|
||||
var ids;
|
||||
var process_action = function(action) {
|
||||
this.reload(ids, true);
|
||||
if (typeof action == 'string') {
|
||||
@@ -1270,10 +1271,6 @@
|
||||
};
|
||||
|
||||
var selected_records = this.current_view.selected_records();
|
||||
var ids = selected_records.map(
|
||||
function(record) {
|
||||
return record.id;
|
||||
});
|
||||
this.current_view.set_value();
|
||||
var fields = this.current_view.get_fields();
|
||||
|
||||
@@ -1326,6 +1323,10 @@
|
||||
jQuery.extend(context, record.get_timestamp());
|
||||
}
|
||||
record.save(false).done(function() {
|
||||
ids = selected_records.map(
|
||||
function(record) {
|
||||
return record.id;
|
||||
});
|
||||
record.model.execute(attributes.name,
|
||||
[ids], context).then(process_action.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
Reference in new issue
Block a user