diff --git a/web_ir_actions_act_multi/README.rst b/web_ir_actions_act_multi/README.rst new file mode 100644 index 00000000..317b1956 --- /dev/null +++ b/web_ir_actions_act_multi/README.rst @@ -0,0 +1,60 @@ +.. image:: https://www.gnu.org/graphics/lgplv3-147x51.png + :target: https://www.gnu.org/licenses/lgpl-3.0.en.html + :alt: License: LGPL-v3 + +================= +Web Actions Multi +================= + +This module provides a way to trigger more than one action on ActionManager + +Usage +===== + +To use this functionality you need to return following action with list of actions to execute: + +.. code-block:: python + + @api.multi + def foo(): + self.ensure_one() + return { + 'type': 'ir.actions.act_multi', + 'actions': [ + {'type': 'ir.actions.act_window_close'}, + {'type': 'ir.actions.act_view_reload'}, + ] + } + +Bug Tracker +=========== + +Bugs are tracked on `GitHub Issues +`_. In case of trouble, please +check there if your issue has already been reported. If you spotted it first, +help us smash it by providing detailed and welcomed feedback. + +Credits +======= + +Contributors +------------ + +* Petar Najman +* Mladen Meseldzija + + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose +mission is to support the collaborative development of Odoo features and +promote its widespread use. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/web_ir_actions_act_multi/__init__.py b/web_ir_actions_act_multi/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/web_ir_actions_act_multi/__manifest__.py b/web_ir_actions_act_multi/__manifest__.py new file mode 100644 index 00000000..4a7ed9d7 --- /dev/null +++ b/web_ir_actions_act_multi/__manifest__.py @@ -0,0 +1,17 @@ +# Copyright 2017 - 2018 Modoolar +# License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). + +{ + "name": "Web Actions Multi", + "summary": "Enables triggering of more than one action on ActionManager", + "category": "Web", + "version": "11.0.1.0.0", + "license": "LGPL-3", + "author": "Modoolar, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/web/", + "depends": ["web"], + "data": [ + "views/web_ir_actions_act_multi.xml", + ], + "installable": True, +} diff --git a/web_ir_actions_act_multi/static/description/icon.png b/web_ir_actions_act_multi/static/description/icon.png new file mode 100644 index 00000000..3a0328b5 Binary files /dev/null and b/web_ir_actions_act_multi/static/description/icon.png differ diff --git a/web_ir_actions_act_multi/static/src/js/web_ir_actions_act_multi.js b/web_ir_actions_act_multi/static/src/js/web_ir_actions_act_multi.js new file mode 100644 index 00000000..e5c5d86e --- /dev/null +++ b/web_ir_actions_act_multi/static/src/js/web_ir_actions_act_multi.js @@ -0,0 +1,31 @@ +// Copyright 2017 - 2018 Modoolar +// License LGPLv3.0 or later (https://www.gnu.org/licenses/lgpl-3.0.en.html). + +odoo.define('web_ir_actions_act_multi.ir_actions_act_multi', function (require) { +"use strict"; + + var ActionManager = require('web.ActionManager'); + + ActionManager.include({ + + execute_ir_actions_act_multi: function(actions, options, index){ + var self = this; + + if (index >= actions.length){ + return actions[actions.length-1]; + } + + return self.do_action(actions[index],options) + .then(function(){ + index++; + return self.execute_ir_actions_act_multi(actions, options, index); + }); + }, + + ir_actions_act_multi: function(action, options){ + return this.execute_ir_actions_act_multi(action.actions, options, 0); + }, + + }); + +}); diff --git a/web_ir_actions_act_multi/views/web_ir_actions_act_multi.xml b/web_ir_actions_act_multi/views/web_ir_actions_act_multi.xml new file mode 100644 index 00000000..2df56347 --- /dev/null +++ b/web_ir_actions_act_multi/views/web_ir_actions_act_multi.xml @@ -0,0 +1,14 @@ + + + +