summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/view_list_editable.js
diff options
context:
space:
mode:
authorFabien Meghazi <fme@openerp.com>2012-10-30 15:06:30 +0100
committerFabien Meghazi <fme@openerp.com>2012-10-30 15:06:30 +0100
commitca6c49becf9ce72e4f1a37f04bc89dae417be196 (patch)
treeed310de02126375971a7becd6bfc0aab58a13ef3 /addons/web/static/src/js/view_list_editable.js
parenteb1c4d0f93bcaf77bfe00adea11df5d7d40c8c20 (diff)
[IMP] jQuery deferred API changes refactoring. Changed 'then's in 'done'/'fail' and 'pipe's in 'then'
bzr revid: fme@openerp.com-20121030140630-gf20ye8fou1ebxft
Diffstat (limited to 'addons/web/static/src/js/view_list_editable.js')
-rw-r--r--addons/web/static/src/js/view_list_editable.js30
1 files changed, 15 insertions, 15 deletions
diff --git a/addons/web/static/src/js/view_list_editable.js b/addons/web/static/src/js/view_list_editable.js
index acc1d781976..92a314a9e03 100644
--- a/addons/web/static/src/js/view_list_editable.js
+++ b/addons/web/static/src/js/view_list_editable.js
@@ -127,7 +127,7 @@ openerp.web.list_editable = function (instance) {
// restartable
this.editor = this.make_editor();
var editor_ready = this.editor.prependTo(this.$el)
- .then(this.proxy('setup_events'));
+ .done(this.proxy('setup_events'));
return $.when(result, editor_ready);
} else {
@@ -146,7 +146,7 @@ openerp.web.list_editable = function (instance) {
},
do_button_action: function (name, id, callback) {
var self = this, args = arguments;
- this.ensure_saved().then(function (done) {
+ this.ensure_saved().done(function (done) {
if (!id && done.created) {
id = done.record.get('id');
}
@@ -191,7 +191,7 @@ openerp.web.list_editable = function (instance) {
at: this.prepends_on_create() ? 0 : null});
}
- return this.ensure_saved().pipe(function () {
+ return this.ensure_saved().then(function () {
var $recordRow = self.groups.get_row_for(record);
var cells = self.get_cells_for($recordRow);
self.fields_for_resize.splice(0, self.fields_for_resize.length);
@@ -208,7 +208,7 @@ openerp.web.list_editable = function (instance) {
// FIXME: need better way to get the field back from bubbling (delegated) DOM events somehow
field.$el.attr('data-fieldname', field_name);
self.fields_for_resize.push({field: field, cell: cell});
- }, options).pipe(function () {
+ }, options).then(function () {
$recordRow.addClass('oe_edition');
self.resize_fields();
return record.attributes;
@@ -267,7 +267,7 @@ openerp.web.list_editable = function (instance) {
form: this.editor.form,
cancel: false
}, function () {
- return this.editor.save().pipe(function (attrs) {
+ return this.editor.save().then(function (attrs) {
var created = false;
var record = self.records.get(attrs.id);
if (!record) {
@@ -281,9 +281,9 @@ openerp.web.list_editable = function (instance) {
// record which has *just* been saved, so first perform all
// onwrites then do a final reload of the record
return self.handle_onwrite(record)
- .pipe(function () {
+ .then(function () {
return self.reload_record(record); })
- .pipe(function () {
+ .then(function () {
return { created: created, record: record }; });
});
});
@@ -299,7 +299,7 @@ openerp.web.list_editable = function (instance) {
form: this.editor.form,
cancel: false
}, function () {
- return this.editor.cancel(force).pipe(function (attrs) {
+ return this.editor.cancel(force).then(function (attrs) {
if (attrs.id) {
var record = self.records.get(attrs.id);
if (!record) {
@@ -343,7 +343,7 @@ openerp.web.list_editable = function (instance) {
message: _.str.sprintf("Event %s:before cancelled",
event_name)});
}
- return $.when(action.call(this)).then(function () {
+ return $.when(action.call(this)).done(function () {
self.trigger.apply(self, [event_name + ':after']
.concat(_.toArray(arguments)));
});
@@ -373,7 +373,7 @@ openerp.web.list_editable = function (instance) {
var on_write_callback = self.fields_view.arch.attrs.on_write;
if (!on_write_callback) { return $.when(); }
return this.dataset.call(on_write_callback, [source_record.get('id')])
- .pipe(function (ids) {
+ .then(function (ids) {
return $.when.apply(
null, _(ids).map(
_.bind(self.handle_onwrite_record, self, source_record)));
@@ -434,7 +434,7 @@ openerp.web.list_editable = function (instance) {
_next: function (next_record, options) {
next_record = next_record || 'succ';
var self = this;
- return this.save_edition().pipe(function (saveInfo) {
+ return this.save_edition().then(function (saveInfo) {
if (saveInfo.created) {
return self.start_edition();
}
@@ -638,7 +638,7 @@ openerp.web.list_editable = function (instance) {
var _super = this._super();
this.form.embedded_view = this._validate_view(
this.delegate.edition_view(this));
- var form_ready = this.form.appendTo(this.$el).then(
+ var form_ready = this.form.appendTo(this.$el).done(
self.form.proxy('do_hide'));
return $.when(_super, form_ready);
},
@@ -719,9 +719,9 @@ openerp.web.list_editable = function (instance) {
var loaded = record
? form.trigger('load_record', _.extend({}, record))
: form.load_defaults();
- return $.when(loaded).pipe(function () {
+ return $.when(loaded).then(function () {
return form.do_show({reload: false});
- }).pipe(function () {
+ }).then(function () {
self.record = form.datarecord;
_(form.fields).each(function (field, name) {
configureField(name, field);
@@ -734,7 +734,7 @@ openerp.web.list_editable = function (instance) {
var self = this;
return this.form
.save(this.delegate.prepends_on_create())
- .pipe(function (result) {
+ .then(function (result) {
var created = result.created && !self.record.id;
if (created) {
self.record.id = result.result;