From ef61526e26e8dc7cbf5856c310aeae7cec24d48f Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Tue, 19 Jul 2016 19:20:32 +0200 Subject: [PATCH 1/3] run onclose handler if we got one --- .../static/src/js/web_ir_actions_act_window_page.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js b/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js index d8c03179..1624fbff 100644 --- a/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js +++ b/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js @@ -30,6 +30,10 @@ openerp.web_ir_actions_act_window_page = function(instance) this.inner_widget.views[this.inner_widget.active_view] .controller.execute_pager_action('previous'); } + if(options && options.on_close) + { + options.on_close(); + } }, ir_actions_act_window_page_next: function(action, options) { @@ -39,6 +43,10 @@ openerp.web_ir_actions_act_window_page = function(instance) this.inner_widget.views[this.inner_widget.active_view] .controller.execute_pager_action('next'); } + if(options && options.on_close) + { + options.on_close(); + } }, }); } From a7843d60495292f507eb43f869fe15849b6f6991 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Thu, 14 Sep 2017 13:59:04 +0200 Subject: [PATCH 2/3] [MIG][10.0] web_ir_actions_act_window_page --- web_ir_actions_act_window_page/README.md | 53 +++++++++++++++++++ .../__manifest__.py | 39 +++++--------- .../src/js/web_ir_actions_act_window_page.js | 45 +++++----------- web_ir_actions_act_window_page/view/qweb.xml | 13 ----- .../views/assets.xml | 11 ++++ 5 files changed, 91 insertions(+), 70 deletions(-) delete mode 100644 web_ir_actions_act_window_page/view/qweb.xml create mode 100644 web_ir_actions_act_window_page/views/assets.xml diff --git a/web_ir_actions_act_window_page/README.md b/web_ir_actions_act_window_page/README.md index c5c6351b..29b6ce9e 100644 --- a/web_ir_actions_act_window_page/README.md +++ b/web_ir_actions_act_window_page/README.md @@ -1,3 +1,8 @@ +.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg + :target: https://www.gnu.org/licenses/agpl + :alt: License: AGPL-3 + +================== Client side paging ================== @@ -11,3 +16,51 @@ or:: which trigger the form's controller to page into the requested direction on the client side. + +A use case could be the case of a validation flow. As a developer, you set up a tree view with a domain on records to be validated. The user opens the first record in a form view and validates the record. The validation method returns the 'next' action type so that the browser window of the user is presented with the next record in the form view. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/162/10.0 + +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 +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Holger Brunn +* Stefan Rijnhart + +Do not contact contributors directly about support or help with technical issues. + +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_window_page/__manifest__.py b/web_ir_actions_act_window_page/__manifest__.py index ba6679a7..dc4edc9a 100644 --- a/web_ir_actions_act_window_page/__manifest__.py +++ b/web_ir_actions_act_window_page/__manifest__.py @@ -1,31 +1,20 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# This module copyright (C) 2013-2015 Therp BV (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## +# coding: utf-8 +# © 2013-2015 Therp BV () +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) { "name": "Window actions for client side paging", "summary": ("Allows a developer to trigger a pager to show the previous " "or next next record in the form view"), - "version": "8.0.1.0.0", "author": "Therp BV,Odoo Community Association (OCA)", - "category": "Dependency", - "depends": ['web'], - 'data': ['view/qweb.xml'], - 'installable': False, + "version": "10.0.1.0.0", + "category": "Technical", + "depends": [ + 'web', + ], + 'data': [ + 'views/assets.xml', + ], + 'installable': True, + 'license': 'AGPL-3', + 'url': 'https://github.com/oca/web', } diff --git a/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js b/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js index 1624fbff..b9fbe4fd 100644 --- a/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js +++ b/web_ir_actions_act_window_page/static/src/js/web_ir_actions_act_window_page.js @@ -1,34 +1,16 @@ -//-*- coding: utf-8 -*- -//############################################################################ -// -// OpenERP, Open Source Management Solution -// This module copyright (C) 2013-2015 Therp BV (). -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// -//############################################################################ +// coding: utf-8 +// © 2013-2015 Therp BV () +// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) +odoo.define('web.ir_actions_act_window_page', function(require) { -openerp.web_ir_actions_act_window_page = function(instance) -{ - instance.web.ActionManager.include({ + var ActionManager = require('web.ActionManager'); + ActionManager.include({ ir_actions_act_window_page_prev: function(action, options) { - if(this.inner_widget && this.inner_widget.active_view == 'form' && - this.inner_widget.views[this.inner_widget.active_view]) + if(this.inner_widget && this.inner_widget.active_view.type == 'form' && + this.inner_widget.active_view) { - this.inner_widget.views[this.inner_widget.active_view] - .controller.execute_pager_action('previous'); + this.inner_widget.active_view.controller.pager.previous(); } if(options && options.on_close) { @@ -37,11 +19,10 @@ openerp.web_ir_actions_act_window_page = function(instance) }, ir_actions_act_window_page_next: function(action, options) { - if(this.inner_widget && this.inner_widget.active_view == 'form' && - this.inner_widget.views[this.inner_widget.active_view]) + if(this.inner_widget && this.inner_widget.active_view.type == 'form' && + this.inner_widget.active_view) { - this.inner_widget.views[this.inner_widget.active_view] - .controller.execute_pager_action('next'); + this.inner_widget.active_view.controller.pager.next(); } if(options && options.on_close) { @@ -49,4 +30,4 @@ openerp.web_ir_actions_act_window_page = function(instance) } }, }); -} +}); diff --git a/web_ir_actions_act_window_page/view/qweb.xml b/web_ir_actions_act_window_page/view/qweb.xml deleted file mode 100644 index d3563bb3..00000000 --- a/web_ir_actions_act_window_page/view/qweb.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - diff --git a/web_ir_actions_act_window_page/views/assets.xml b/web_ir_actions_act_window_page/views/assets.xml new file mode 100644 index 00000000..f045d63a --- /dev/null +++ b/web_ir_actions_act_window_page/views/assets.xml @@ -0,0 +1,11 @@ + + + + From e08bd6520ab82e0e258b5f9da75cfca2eeb27fc7 Mon Sep 17 00:00:00 2001 From: Stefan Rijnhart Date: Thu, 14 Sep 2017 21:38:07 +0200 Subject: [PATCH 3/3] [ADD] Demo data for testing --- web_ir_actions_act_window_page/README.md | 2 ++ .../__manifest__.py | 3 ++ .../demo/demo_action.xml | 35 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 web_ir_actions_act_window_page/demo/demo_action.xml diff --git a/web_ir_actions_act_window_page/README.md b/web_ir_actions_act_window_page/README.md index 29b6ce9e..6818c586 100644 --- a/web_ir_actions_act_window_page/README.md +++ b/web_ir_actions_act_window_page/README.md @@ -22,6 +22,8 @@ A use case could be the case of a validation flow. As a developer, you set up a Usage ===== +See the 'Previous Partner' and 'Next Partner' buttons that this module's demo data adds to the partner form view. + .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/162/10.0 diff --git a/web_ir_actions_act_window_page/__manifest__.py b/web_ir_actions_act_window_page/__manifest__.py index dc4edc9a..f7ead113 100644 --- a/web_ir_actions_act_window_page/__manifest__.py +++ b/web_ir_actions_act_window_page/__manifest__.py @@ -14,6 +14,9 @@ 'data': [ 'views/assets.xml', ], + 'demo': [ + 'demo/demo_action.xml', + ], 'installable': True, 'license': 'AGPL-3', 'url': 'https://github.com/oca/web', diff --git a/web_ir_actions_act_window_page/demo/demo_action.xml b/web_ir_actions_act_window_page/demo/demo_action.xml new file mode 100644 index 00000000..094abbc0 --- /dev/null +++ b/web_ir_actions_act_window_page/demo/demo_action.xml @@ -0,0 +1,35 @@ + + + + + Previous partner + + action = {"type": "ir_actions_act_window_page_prev"} + + + + Next partner + + action = {"type": "ir_actions_act_window_page_next"} + + + + + res.partner + + +
+
+
+
+ +