summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/widgets/attach_document.js
diff options
context:
space:
mode:
Diffstat (limited to 'addons/web/static/src/js/widgets/attach_document.js')
-rw-r--r--addons/web/static/src/js/widgets/attach_document.js41
1 files changed, 21 insertions, 20 deletions
diff --git a/addons/web/static/src/js/widgets/attach_document.js b/addons/web/static/src/js/widgets/attach_document.js
index 13496f3aea7..3175875c151 100644
--- a/addons/web/static/src/js/widgets/attach_document.js
+++ b/addons/web/static/src/js/widgets/attach_document.js
@@ -108,26 +108,27 @@ var AttachDocument = Widget.extend({
* @private
*/
_onFileLoaded: function () {
- var self = this,
- def = $.Deferred();
-
- if (self.node.attrs.action) {
- // the first argument isn't a file but the jQuery.Event
- var files = Array.prototype.slice.call(arguments, 1);
- self._rpc({
- model: self.res_model,
- method: self.node.attrs.action,
- args: [self.res_id],
- kwargs: {
- 'attachment_ids': _.map(files, function (file) {return file.id;}),
- }
- }).then( function () {
- def.resolve();
- });
- } else {
- def.resolve();
- }
- return $.when(def).then(function () {
+ var self = this;
+ return new Promise(function (resolve) {
+ if (self.node.attrs.action) {
+ // the first argument isn't a file but the jQuery.Event
+ var files = Array.prototype.slice.call(arguments, 1);
+ self._rpc({
+ model: self.res_model,
+ method: self.node.attrs.action,
+ args: [self.res_id],
+ kwargs: {
+ attachment_ids: _.map(files, function (file) {
+ return file.id;
+ }),
+ }
+ }).then(function () {
+ resolve();
+ });
+ } else {
+ resolve();
+ }
+ }).then(function () {
self.trigger_up('reload');
framework.unblockUI();
});