diff --git a/setup/web_ir_actions_act_window_page/odoo/addons/web_ir_actions_act_window_page b/setup/web_ir_actions_act_window_page/odoo/addons/web_ir_actions_act_window_page new file mode 120000 index 000000000..f96e80a05 --- /dev/null +++ b/setup/web_ir_actions_act_window_page/odoo/addons/web_ir_actions_act_window_page @@ -0,0 +1 @@ +../../../../web_ir_actions_act_window_page \ No newline at end of file diff --git a/setup/web_ir_actions_act_window_page/setup.py b/setup/web_ir_actions_act_window_page/setup.py new file mode 100644 index 000000000..28c57bb64 --- /dev/null +++ b/setup/web_ir_actions_act_window_page/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/web_ir_actions_act_window_page/README.rst b/web_ir_actions_act_window_page/README.rst new file mode 100644 index 000000000..4bd7d2607 --- /dev/null +++ b/web_ir_actions_act_window_page/README.rst @@ -0,0 +1,98 @@ +===================================== +Window actions for client side paging +===================================== + +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:07dae326aca4830ca73888e3107f5c46bf00000bbc6c5b32be9494b495c21719 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github + :target: https://github.com/OCA/web/tree/16.0/web_ir_actions_act_window_page + :alt: OCA/web +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_ir_actions_act_window_page + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0 + :alt: Try me on Runboat + +|badge1| |badge2| |badge3| |badge4| |badge5| + +This addon allows a developer to return the following action types:: + +{'type': 'ir.actions.act_window.page.next'} + +or:: + +{'type': 'ir.actions.act_window.page.prev'} + +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. + +**Table of contents** + +.. contents:: + :local: + +Usage +===== + +See the 'Previous Partner' and 'Next Partner' buttons that this module's demo data adds +to the partner form view. + +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 to smash it by providing a detailed and welcomed +`feedback `_. + +Do not contact contributors directly about support or help with technical issues. + +Credits +======= + +Authors +~~~~~~~ + +* Hunki Enterprises BV +* Therp BV + +Contributors +~~~~~~~~~~~~ + +* Holger Brunn (https://hunki-enterprises.com) +* Stefan Rijnhart (https://opener.amsterdam) + +Maintainers +~~~~~~~~~~~ + +This module is maintained by the OCA. + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: https://odoo-community.org + +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. + +This module is part of the `OCA/web `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_ir_actions_act_window_page/__init__.py b/web_ir_actions_act_window_page/__init__.py new file mode 100644 index 000000000..784f5c8cf --- /dev/null +++ b/web_ir_actions_act_window_page/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2023 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import models diff --git a/web_ir_actions_act_window_page/__manifest__.py b/web_ir_actions_act_window_page/__manifest__.py new file mode 100644 index 000000000..0a6046887 --- /dev/null +++ b/web_ir_actions_act_window_page/__manifest__.py @@ -0,0 +1,22 @@ +# © 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" + ), + "author": "Hunki Enterprises BV, Therp BV,Odoo Community Association (OCA)", + "version": "16.0.1.0.0", + "category": "Technical", + "depends": ["web"], + "assets": { + "web.assets_backend": [ + "web_ir_actions_act_window_page/static/src/web_ir_actions_act_window_page.esm.js", + ] + }, + "demo": ["demo/demo_action.xml"], + "installable": True, + "license": "AGPL-3", + "website": "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 000000000..7ad1f2c7c --- /dev/null +++ b/web_ir_actions_act_window_page/demo/demo_action.xml @@ -0,0 +1,43 @@ + + + + + Previous partner + + code + action = {"type": "ir.actions.act_window.page.prev"} + + + + Next partner + + code + action = {"type": "ir.actions.act_window.page.next"} + + + + + res.partner + + +
+
+
+
+ +
diff --git a/web_ir_actions_act_window_page/i18n/de.po b/web_ir_actions_act_window_page/i18n/de.po new file mode 100644 index 000000000..d9255cb53 --- /dev/null +++ b/web_ir_actions_act_window_page/i18n/de.po @@ -0,0 +1,39 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_ir_actions_act_window_page +# +# Translators: +# Rudolf Schnapka , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-01-03 03:50+0000\n" +"PO-Revision-Date: 2018-01-03 03:50+0000\n" +"Last-Translator: Rudolf Schnapka , 2018\n" +"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n" +"Language: de\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#. module: web_ir_actions_act_window_page +#: model:ir.ui.view,arch_db:web_ir_actions_act_window_page.view_partner_form +msgid "Next Partner" +msgstr "Nächster Partner" + +#. module: web_ir_actions_act_window_page +#: model:ir.actions.server,name:web_ir_actions_act_window_page.demo_pager_next +msgid "Next partner" +msgstr "Nächster Partner" + +#. module: web_ir_actions_act_window_page +#: model:ir.ui.view,arch_db:web_ir_actions_act_window_page.view_partner_form +msgid "Previous Partner" +msgstr "Voriger Partner" + +#. module: web_ir_actions_act_window_page +#: model:ir.actions.server,name:web_ir_actions_act_window_page.demo_pager_previous +msgid "Previous partner" +msgstr "Voriger Partner" diff --git a/web_ir_actions_act_window_page/i18n/web_ir_actions_act_window_page.pot b/web_ir_actions_act_window_page/i18n/web_ir_actions_act_window_page.pot new file mode 100644 index 000000000..f80682872 --- /dev/null +++ b/web_ir_actions_act_window_page/i18n/web_ir_actions_act_window_page.pot @@ -0,0 +1,35 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * web_ir_actions_act_window_page +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 10.0\n" +"Report-Msgid-Bugs-To: \n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: web_ir_actions_act_window_page +#: model:ir.ui.view,arch_db:web_ir_actions_act_window_page.view_partner_form +msgid "Next Partner" +msgstr "" + +#. module: web_ir_actions_act_window_page +#: model:ir.actions.server,name:web_ir_actions_act_window_page.demo_pager_next +msgid "Next partner" +msgstr "" + +#. module: web_ir_actions_act_window_page +#: model:ir.ui.view,arch_db:web_ir_actions_act_window_page.view_partner_form +msgid "Previous Partner" +msgstr "" + +#. module: web_ir_actions_act_window_page +#: model:ir.actions.server,name:web_ir_actions_act_window_page.demo_pager_previous +msgid "Previous partner" +msgstr "" + diff --git a/web_ir_actions_act_window_page/models/__init__.py b/web_ir_actions_act_window_page/models/__init__.py new file mode 100644 index 000000000..60d068165 --- /dev/null +++ b/web_ir_actions_act_window_page/models/__init__.py @@ -0,0 +1,3 @@ +# Copyright 2023 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from . import ir_actions_act_window_page diff --git a/web_ir_actions_act_window_page/models/ir_actions_act_window_page.py b/web_ir_actions_act_window_page/models/ir_actions_act_window_page.py new file mode 100644 index 000000000..107b6569a --- /dev/null +++ b/web_ir_actions_act_window_page/models/ir_actions_act_window_page.py @@ -0,0 +1,27 @@ +# Copyright 2023 Hunki Enterprises BV +# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). +from odoo import models + + +class IrActionsActWindowPagePrev(models.AbstractModel): + _name = "ir.actions.act_window.page.prev" + _description = "Action to page to the previous record from a form view button" + + def _get_readable_fields(self): + return set() # pragma: no cover + + +class IrActionsActWindowPageNext(models.AbstractModel): + _name = "ir.actions.act_window.page.next" + _description = "Action to page to the next record from a form view button" + + def _get_readable_fields(self): + return set() # pragma: no cover + + +class IrActionsActWindowPageList(models.AbstractModel): + _name = "ir.actions.act_window.page.list" + _description = "Action to switch to the list view" + + def _get_readable_fields(self): + return set() # pragma: no cover diff --git a/web_ir_actions_act_window_page/readme/CONTRIBUTORS.rst b/web_ir_actions_act_window_page/readme/CONTRIBUTORS.rst new file mode 100644 index 000000000..94a367e80 --- /dev/null +++ b/web_ir_actions_act_window_page/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Holger Brunn (https://hunki-enterprises.com) +* Stefan Rijnhart (https://opener.amsterdam) diff --git a/web_ir_actions_act_window_page/readme/DESCRIPTION.rst b/web_ir_actions_act_window_page/readme/DESCRIPTION.rst new file mode 100644 index 000000000..3f37f2e84 --- /dev/null +++ b/web_ir_actions_act_window_page/readme/DESCRIPTION.rst @@ -0,0 +1,15 @@ +This addon allows a developer to return the following action types:: + +{'type': 'ir.actions.act_window.page.next'} + +or:: + +{'type': 'ir.actions.act_window.page.prev'} + +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. diff --git a/web_ir_actions_act_window_page/readme/USAGE.rst b/web_ir_actions_act_window_page/readme/USAGE.rst new file mode 100644 index 000000000..0a69dadc6 --- /dev/null +++ b/web_ir_actions_act_window_page/readme/USAGE.rst @@ -0,0 +1,2 @@ +See the 'Previous Partner' and 'Next Partner' buttons that this module's demo data adds +to the partner form view. diff --git a/web_ir_actions_act_window_page/static/description/icon.png b/web_ir_actions_act_window_page/static/description/icon.png new file mode 100644 index 000000000..f1006195e Binary files /dev/null and b/web_ir_actions_act_window_page/static/description/icon.png differ diff --git a/web_ir_actions_act_window_page/static/description/index.html b/web_ir_actions_act_window_page/static/description/index.html new file mode 100644 index 000000000..e2f206671 --- /dev/null +++ b/web_ir_actions_act_window_page/static/description/index.html @@ -0,0 +1,442 @@ + + + + + + +Window actions for client side paging + + + +
+

Window actions for client side paging

+ + +

Beta License: AGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

This addon allows a developer to return the following action types:

+
+{'type': 'ir.actions.act_window.page.next'}
+
+

or:

+
+{'type': 'ir.actions.act_window.page.prev'}
+
+

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.

+

Table of contents

+ +
+

Usage

+

See the ‘Previous Partner’ and ‘Next Partner’ buttons that this module’s demo data adds +to the partner form view.

+
+
+

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 to smash it by providing a detailed and welcomed +feedback.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Hunki Enterprises BV
  • +
  • Therp BV
  • +
+
+ +
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/web project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/web_ir_actions_act_window_page/static/src/web_ir_actions_act_window_page.esm.js b/web_ir_actions_act_window_page/static/src/web_ir_actions_act_window_page.esm.js new file mode 100644 index 000000000..48d67ace3 --- /dev/null +++ b/web_ir_actions_act_window_page/static/src/web_ir_actions_act_window_page.esm.js @@ -0,0 +1,40 @@ +/** @odoo-module **/ +// (c) 2013-2015 Therp BV () +// (c) 2023 Hunki Enterprises BV () +// License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + +import {Pager} from "@web/core/pager/pager"; +import {patch} from "@web/core/utils/patch"; +import {registry} from "@web/core/registry"; +import {useBus} from "@web/core/utils/hooks"; + +const actionHandlersRegistry = registry.category("action_handlers"); + +async function executeWindowActionPage({env}, direction) { + return env.bus.trigger("pager:navigate", {direction}); +} + +async function executeWindowActionList({env}) { + return env.services.action.switchView("list"); +} + +actionHandlersRegistry.add("ir.actions.act_window.page.prev", async (params) => + executeWindowActionPage(params, -1) +); +actionHandlersRegistry.add("ir.actions.act_window.page.next", async (params) => + executeWindowActionPage(params, 1) +); +actionHandlersRegistry.add("ir.actions.act_window.page.list", async (params) => + executeWindowActionList(params) +); + +patch(Pager.prototype, "navigate event listener", { + setup() { + this._super.apply(); + const handleNavigate = (ev) => this._handleNavigate(ev); + useBus(this.env.bus, "pager:navigate", handleNavigate); + }, + _handleNavigate(ev) { + return this.navigate(ev.detail.direction); + }, +});