Skip to content

Commit

Permalink
[ADD] confirmation_wizard: Module added
Browse files Browse the repository at this point in the history
  • Loading branch information
geomer198 committed Aug 31, 2024
1 parent d55713a commit 7b9b96f
Show file tree
Hide file tree
Showing 15 changed files with 905 additions and 0 deletions.
119 changes: 119 additions & 0 deletions confirmation_wizard/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
===================
Confirmation Wizard
===================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:efcbab8311be7e220ab27fa46f0fcd4567d0ad071dfc40be6e5aece82b96e299
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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--ux-lightgray.png?logo=github
:target: https://github.com/OCA/server-ux/tree/16.0/confirmation_wizard
:alt: OCA/server-ux
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/server-ux-16-0/server-ux-16-0-confirmation_wizard
: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-ux&target_branch=16.0
:alt: Try me on Runboat

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

The module lets the developer trigger a confirmation wizard during any action in Odoo. Based on data passed to the wizard and, based on user input, executes specified methods or close wizard.

**Table of contents**

.. contents::
:local:

Usage
=====

To create configuration wizard:

Use confirm wizard which return method (return_type = method):

.. code-block:: python
def change_address(self, address):
if not self._context("skip_confirm", False):
# Confirmation wizard
return (
self.env["confirmation.wizard"]
.with_context(skip_confirm=True)
.confirm_message(
_("Are you ready change partner address"),
records=self.env["res.partner"].browse(1), # One or more records
title="Confirm",
method="change_address",
callback_params={"address": address}
)
)
... # Your code here
Use confirm wizard which return window close (return_type = window_close):

.. code-block:: python
def method(self):
...
return (
self.env["confirmation.wizard"]
.with_context(invisible_cancel=True)
.confirm_no_action_message(
message="Message",
title="Notification"
)
)
Bug Tracker
===========

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

* Cetmix

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

* `Cetmix <cetmix.com>`_:
* Ivan Sokolov
* Mikhail Lapin
* Maksim Shurupov

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/server-ux <https://github.com/OCA/server-ux/tree/16.0/confirmation_wizard>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions confirmation_wizard/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import wizard
21 changes: 21 additions & 0 deletions confirmation_wizard/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright (C) 2024 Cetmix OÜ
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Confirmation Wizard",
"summary": """
This module adds a confirmation wizard that can be called with code.
It does nothing by itself.
""",
"version": "16.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/server-ux",
"author": "Cetmix, Odoo Community Association (OCA)",
"license": "AGPL-3",
"application": False,
"installable": True,
"depends": ["base"],
"data": [
"security/ir.model.access.csv",
"wizard/confirmation_wizard.xml",
],
}
4 changes: 4 additions & 0 deletions confirmation_wizard/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* `Cetmix <cetmix.com>`_:
* Ivan Sokolov
* Mikhail Lapin
* Maksim Shurupov
1 change: 1 addition & 0 deletions confirmation_wizard/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The module lets the developer trigger a confirmation wizard during any action in Odoo. Based on data passed to the wizard and, based on user input, executes specified methods or close wizard.
36 changes: 36 additions & 0 deletions confirmation_wizard/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
To create configuration wizard:

Use confirm wizard which return method (return_type = method):

.. code-block:: python
def change_address(self, address):
if not self._context("skip_confirm", False):
# Confirmation wizard
return (
self.env["confirmation.wizard"]
.with_context(skip_confirm=True)
.confirm_message(
_("Are you ready change partner address"),
records=self.env["res.partner"].browse(1), # One or more records
title="Confirm",
method="change_address",
callback_params={"address": address}
)
)
... # Your code here
Use confirm wizard which return window close (return_type = window_close):

.. code-block:: python
def method(self):
...
return (
self.env["confirmation.wizard"]
.with_context(invisible_cancel=True)
.confirm_no_action_message(
message="Message",
title="Notification"
)
)
2 changes: 2 additions & 0 deletions confirmation_wizard/security/ir.model.access.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_confirmation_wizard,access.confirmation.wizard,model_confirmation_wizard,base.group_system,1,1,1,1
Loading

0 comments on commit 7b9b96f

Please sign in to comment.