summaryrefslogtreecommitdiff
path: root/addons/web/static/src/js
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2018-01-12 16:21:48 +0100
committerSimon Lejeune <sle@openerp.com>2018-02-01 15:26:59 +0100
commit17f5f74af94384e040e39eb146ff5fbb84fb02ff (patch)
treeb01bf30034d5591155aa41d9ab70dcfa43eccfcb /addons/web/static/src/js
parent18d5b11cb4a58a3bd0676427d318249a127a6a5f (diff)
[IMP] mail: redirect on mail activity
Allow to redirect on a form view when the user click on a html tag a with data-oe-model and data-oe-id specified. In order to avoid code duplication the do_action already existing in mail_thread is moved in the action_manager and mail_thread and mail_activity use a trigger_up in order to call it.
Diffstat (limited to 'addons/web/static/src/js')
-rw-r--r--addons/web/static/src/js/chrome/action_manager.js19
1 files changed, 19 insertions, 0 deletions
diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/js/chrome/action_manager.js
index ef2baaaad38..cea75c56726 100644
--- a/addons/web/static/src/js/chrome/action_manager.js
+++ b/addons/web/static/src/js/chrome/action_manager.js
@@ -27,6 +27,7 @@ var ActionManager = Widget.extend({
breadcrumb_clicked: '_onBreadcrumbClicked',
history_back: '_onHistoryBack',
push_state: '_onPushState',
+ redirect: '_onRedirect',
},
/**
@@ -885,6 +886,24 @@ var ActionManager = Widget.extend({
this._pushState(ev.data.controllerID, ev.data.state);
}
},
+ /**
+ * Intercepts and triggers a redirection on a link
+ *
+ * @private
+ * @param {OdooEvent} ev
+ * @param {integer} ev.data.res_id
+ * @param {string} ev.data.res_model
+ */
+ _onRedirect: function (ev) {
+ this.do_action({
+ type:'ir.actions.act_window',
+ view_type: 'form',
+ view_mode: 'form',
+ res_model: ev.data.res_model,
+ views: [[false, 'form']],
+ res_id: ev.data.res_id,
+ });
+ },
});
return ActionManager;