8000 [16.0][ADD] server_action_input_box: Adds a server action wizard input utility by jesanmor · Pull Request #3293 · OCA/server-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[16.0][ADD] server_action_input_box: Adds a server action wizard input utility #3293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: 16.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
208 changes: 208 additions & 0 deletions 9E7A server_action_input_box/LICENSE

Large diffs are not rendered by default.

157 changes: 157 additions & 0 deletions server_action_input_box/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
=======================
Server Action Input Box
=======================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:107d06a72628a1d4821ac84a4216bed93501eef7ee8ed72a3188c565dce64ca3
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |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%2Fserver--tools-lightgray.png?logo=github
:target: https://github.com/OCA/server-tools/tree/16.0/server_action_input_box
:alt: OCA/server-tools
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-tools-16-0/server-tools-16-0-server_action_input_box
: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/server-tools&target_branch=16.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Description
-----------

Server actions provide us with the capability to perform operations on records of a model,
both individually and in bulk. In certain cases, it is necessary to adjust specific
parameters of these actions based on circumstances. Through the incorporation of an
input box provided by this module, we have the flexibility to specify these parameters on the fly,
without the need to directly modify the server action.

Although all code configuration is done through this module, its execution takes place within a server action,
ensuring the security and reliability inherent in the Odoo environment.

Key Features
============

- **Perfect Integration:** The application seamlessly integrates with Odoo Server Actions. You can access it by clicking on "Actions with Parameters" through the "Technical" menu in the Actions section.

- **User-Friendly Interface:** Users can configure the target model where the action will be performed, the parameters to be requested from the input box, and the Python code of the action using the environment variables specific to Server Actions and the variables associated with user-created parameters in this application.

- **Flexible Configuration:** The module allows users to specify as many parameters as needed. They can choose a "one2many" field of the target model as the set of records on which the action will be performed. Users can select whether the action will be performed in bulk (the same parameter value for all) or individually (configure the parameter value one by one for each record).

- **Security:** While all code configuration is done through this module, its execution takes place within a Server Action, ensuring the inherent security and reliability of the Odoo environment. Optionally, it includes a confirmation box to appear at the moment of executing the action, providing the opportunity to cancel at the last moment.

**Table of contents**

.. contents::
:local:

Installation
============

#. Clone the module from `OCA/server-tools <https://github.com/OCA/server-tools/tree/16.0/server_action_input_box>`_
#. Install the module in your Odoo instance.
#. Configure module settings according to your business requirements.

Usage
=====

Access the application from the menu: Technical > Actions > Actions with parameters.

.. image:: static/src/img/tree_view.jpg
:alt: Access the application from the menu
:width: 800px

Example of action to change the text case.

.. image:: static/src/img/use_case_b_config.jpg
:alt: Example of action to change the text case
:width: 800px

Access the action from the model menu.

.. image:: static/src/img/action_menu.jpg
:alt: View of the configured action input box
:width: 800px

View of the configured action input box.

.. image:: static/src/img/use_case_b_result.jpg
:alt: View of the configured action input box
:width: 800px

Optionally you can activate write confirmation. Check on "Ask for Confirmation" field.

.. image:: static/src/img/write_confirmation_result.jpg
:alt: Optionally you can activate write confirmation
:width: 800px

Check on "Apply to linked field lines" field to apply to records from an on2many field (ex.: Journal Items).

.. image:: static/src/img/use_case_a_config.jpg
:alt: Set an action to apply to records in a one2many field
:width: 800px

View of the configured action input box.

.. image:: static/src/img/use_case_a_result.jpg
:alt: View of the configured action input box
:width: 800px

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/server-tools/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/server-tools/issues/new?body=module:%20server_action_input_box%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
~~~~~~~

* Jesús Sánchez - jesanmor

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

* Jesús Sánchez <jesanmor.dev@gmail.com>

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.

.. |maintainer-jesanmor| image:: https://github.com/jesanmor.png?size=40px
:target: https://github.com/jesanmor
:alt: jesanmor

Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:

|maintainer-jesanmor|

This module is part of the `OCA/server-tools <https://github.com/OCA/server-tools/tree/16.0/server_action_input_box>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions server_action_input_box/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from .hooks import uninstall_hook
32 changes: 32 additions & 0 deletions server_action_input_box/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Copyright 2024 jesanmor - Jesús Sánchez <jesanmor.dev@gmail.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

{
"name": "Server Action Input Box",
"summary": """Shows a parameter input box in a server action
under the 'Action' menu of the model.""",
"author": "Jesús Sánchez - jesanmor, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-tools",
"maintainers": ["jesanmor"],
"development_status": "Beta",
"category": "technical",
"version": "16.0.1.0.0",
"depends": [
"base",
"web",
],
"data": [
"security/ir.model.access.csv",
"views/server_action_input_box_views.xml",
],
"assets": {
"web.assets_backend": [
"server_action_input_box/static/src/js/show_server_action_input_box.esm.js",
"server_action_input_box/static/src/xml/show_server_action_input_box.xml",
],
},
"license": "AGPL-3",
"installable": True,
"images": ["static/description/icon.png"],
"uninstall_hook": "uninstall_hook",
}
14 changes: 14 additions & 0 deletions server_action_input_box/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2024 jesanmor - Jesús Sánchez <jesanmor.dev@gmail.com>
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).

from odoo import SUPERUSER_ID, api


def uninstall_hook(cr, registry):
env = api.Environment(cr, SUPERUSER_ID, {})

Check warning on line 8 in server_action_input_box/hooks.py

View check run for this annotation

Codecov / codecov/patch

server_action_input_box/hooks.py#L8

Added line #L8 was not covered by tests

records = env["server.action.input.box"].search([])
actions = records.mapped("ir_action_server_id")
records.write({"ir_action_server_id": False})

Check warning on line 12 in server_action_input_box/hooks.py

View check run for this annotation

Codecov / codecov/patch

server_action_input_box/hooks.py#L10-L12

Added lines #L10 - L12 were not covered by tests

actions.unlink()

Check warning on line 14 in server_action_input_box/hooks.py

View check run for this annotation

Codecov / codecov/patch

server_action_input_box/hooks.py#L14

Added line #L14 was not covered by tests
Loading
0