diff options
| author | David Monjoie <dmo@odoo.com> | 2017-04-20 14:26:19 +0200 |
|---|---|---|
| committer | David Monjoie <dmo@odoo.com> | 2017-05-02 15:24:55 +0200 |
| commit | 642fe9b9c1c0267dfb05b12932be9d3dfe53df40 (patch) | |
| tree | 17010869284849fc120f390e08b769b1765780c6 /addons/web/static/src | |
| parent | e02cee4ea694d9a1f85db8c6c2286ea0480298aa (diff) | |
[FIX] web: support anchor tags with action type in views
Diffstat (limited to 'addons/web/static/src')
| -rw-r--r-- | addons/web/static/src/js/views/abstract_controller.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/js/views/abstract_controller.js index 1dacce59fa6..b84f6ec1951 100644 --- a/addons/web/static/src/js/views/abstract_controller.js +++ b/addons/web/static/src/js/views/abstract_controller.js @@ -19,6 +19,9 @@ var AbstractController = Widget.extend({ custom_events: { open_record: '_onOpenRecord', }, + events: { + 'click a[type="action"]': '_onActionClicked', + }, /** * @constructor @@ -291,6 +294,17 @@ var AbstractController = Widget.extend({ model: this.modelName, }); }, + /** + * When a user clicks on an <a> link with type="action", we need to actually + * do the action. This kind of links is used a lot in no-content helpers. + * + * @private + * @param {OdooEvent} event + */ + _onActionClicked: function (event) { + event.preventDefault(); + this.do_action(event.target.name); + }, }); |
