Skip to content

Commit

Permalink
Merge PR #2548 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by StefanRijnhart
  • Loading branch information
OCA-git-bot committed Aug 8, 2023
2 parents 0395d89 + 06c1460 commit 8926555
Show file tree
Hide file tree
Showing 16 changed files with 778 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/web_ir_actions_act_window_page/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
98 changes: 98 additions & 0 deletions web_ir_actions_act_window_page/README.rst
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/OCA/web/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 <https://github.com/OCA/web/issues/new?body=module:%20web_ir_actions_act_window_page%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
~~~~~~~

* Hunki Enterprises BV
* Therp BV

Contributors
~~~~~~~~~~~~

* Holger Brunn <[email protected]> (https://hunki-enterprises.com)
* Stefan Rijnhart <[email protected]> (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 <https://github.com/OCA/web/tree/16.0/web_ir_actions_act_window_page>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions web_ir_actions_act_window_page/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Copyright 2023 Hunki Enterprises BV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from . import models
22 changes: 22 additions & 0 deletions web_ir_actions_act_window_page/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# © 2013-2015 Therp BV (<http://therp.nl>)
# 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",
}
43 changes: 43 additions & 0 deletions web_ir_actions_act_window_page/demo/demo_action.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>

<record model="ir.actions.server" id="demo_pager_previous">
<field name="name">Previous partner</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="state">code</field>
<field name="code">action = {"type": "ir.actions.act_window.page.prev"}</field>
</record>

<record model="ir.actions.server" id="demo_pager_next">
<field name="name">Next partner</field>
<field name="model_id" ref="base.model_res_partner" />
<field name="state">code</field>
<field name="code">action = {"type": "ir.actions.act_window.page.next"}</field>
</record>

<!-- Adding some redundant buttons to the partner form so that this module can be tested on runbot.
You might be more interested in returning this action type from a method in your code. -->
<record id="view_partner_form" model="ir.ui.view">
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form" />
<field name="arch" type="xml">
<div class="oe_button_box" position="inside">
<button
name="%(web_ir_actions_act_window_page.demo_pager_previous)d"
type="action"
string="Previous Partner"
icon="fa-arrow-left"
class="oe_stat_button"
/>
<button
name="%(web_ir_actions_act_window_page.demo_pager_next)d"
type="action"
string="Next Partner"
icon="fa-arrow-right"
class="oe_stat_button"
/>
</div>
</field>
</record>

</odoo>
39 changes: 39 additions & 0 deletions web_ir_actions_act_window_page/i18n/de.po
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>, 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 <[email protected]>, 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"
Original file line number Diff line number Diff line change
@@ -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 ""

3 changes: 3 additions & 0 deletions web_ir_actions_act_window_page/models/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions web_ir_actions_act_window_page/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* Holger Brunn <[email protected]> (https://hunki-enterprises.com)
* Stefan Rijnhart <[email protected]> (https://opener.amsterdam)
15 changes: 15 additions & 0 deletions web_ir_actions_act_window_page/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -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.
2 changes: 2 additions & 0 deletions web_ir_actions_act_window_page/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
See the 'Previous Partner' and 'Next Partner' buttons that this module's demo data adds
to the partner form view.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 8926555

Please sign in to comment.