summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js/core
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2017-04-26 21:06:18 +0200
committerGéry Debongnie <ged@odoo.com>2017-04-27 09:24:59 +0200
commit51e9aba2cb4c9006ca9906562d6b0057cc1f1e85 (patch)
tree8468834be3b891f4c471f499bc351bf2a534571b /addons/web/static/src/js/core
parentd20074c555bf3b25155264d09ced81997eb632ff (diff)
[FIX] web: do_action should properly resolves when complete
We changed the do_action method recently: before, it was calling recursively its parent, now it simply triggers up an event. We also moved it to the 'services' mixin. However, we did not properly connect the 'on_success' option: it is not an option for the view manager, but for the abstract web client. As such, it should not be in the options parameter, but it should simply be a key in the event payload. This commit was found by solving the two following issues: - open sale application, click on 'Inbox' icon to go to discuss, Discuss is opened, but the navbar stays with sales application - after installing module website_crm_partner_assign in kanban view for apps, it does not reload... Both of these were caused by the need to do something after a do_action, and the deferred was not resolved at all.
Diffstat (limited to 'addons/web/static/src/js/core')
-rw-r--r--addons/web/static/src/js/core/mixins.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/addons/web/static/src/js/core/mixins.js b/addons/web/static/src/js/core/mixins.js
index fff2a013bb5..9c643597f04 100644
--- a/addons/web/static/src/js/core/mixins.js
+++ b/addons/web/static/src/js/core/mixins.js
@@ -495,19 +495,23 @@ var ServicesMixin = {
return session;
},
/**
- * Informs the action manager to do an action. This supposes that
- * the action manager can be found amongst the ancestors of the current widget.
- * If that's not the case this method will simply return `false`.
+ * Informs the action manager to do an action. This supposes that the action
+ * manager can be found amongst the ancestors of the current widget.
+ * If that's not the case this method will simply return an unresolved
+ * deferred.
+ *
+ * @param {any} action
+ * @param {any} options
+ * @returns {Deferred}
*/
do_action: function (action, options) {
var def = $.Deferred();
- options = options || {};
- var oldOnSuccess = options.on_success;
- options.on_success = function (result) {
- oldOnSuccess(result);
- def.resolve(result);
- };
- this.trigger_up('do_action', {'action': action, options: options});
+
+ this.trigger_up('do_action', {
+ action: action,
+ options: options,
+ on_success: function (result) { def.resolve(result); },
+ });
return def;
},
do_notify: function (title, message, sticky, className) {