Make create call synchronous
This avoid to create multiple times the same record if Record.save is called multiple times. issue7148 review44211002
This commit is contained in:
1 parent
9f80bb9b4f
commit
aef87ed37a
1 file changed
+2
-5
+2
-5
@@ -516,11 +516,8 @@
|
||||
var values = this.get();
|
||||
if ((this.id < 0) || !jQuery.isEmptyObject(values)) {
|
||||
if (this.id < 0) {
|
||||
prm = this.model.execute('create', [[values]], context);
|
||||
var created = function(ids) {
|
||||
this.id = ids[0];
|
||||
};
|
||||
prm.done(created.bind(this));
|
||||
// synchronous call to avoid multiple creation
|
||||
this.id = this.model.execute('create', [[values]], context, false)[0];
|
||||
} else {
|
||||
if (!jQuery.isEmptyObject(values)) {
|
||||
context._timestamp = this.get_timestamp();
|
||||
|
||||
Reference in new issue
Block a user