Skip to content
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
87 changes: 87 additions & 0 deletions base_tier_validation_authentication_confirm/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
=====================================
Base Tier Validation Password Confirm
=====================================

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

.. |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/18.0/base_tier_validation_authentication_confirm
: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-18-0/server-ux-18-0-base_tier_validation_authentication_confirm
: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=18.0
:alt: Try me on Runboat

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

Allows to add a password confirmation to tier validation, where the user
must confirm his authentication in order to approve or reject the tier
review.

**Table of contents**

.. contents::
:local:

Configuration
=============

To configure this module, you need to:

1. Go to *Settings > Technical > Tier Validations > Tier Definition >
Select one tier definition*.
2. Mark confirm password required field.

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:%20base_tier_validation_authentication_confirm%0Aversion:%2018.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
-------

* ForgeFlow

Contributors
------------

- Arnau Cruz [email protected]

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/18.0/base_tier_validation_authentication_confirm>`_ 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 base_tier_validation_authentication_confirm/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
19 changes: 19 additions & 0 deletions base_tier_validation_authentication_confirm/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
{
"name": "Base Tier Validation Password Confirm",
"summary": "Authentication confirmation for base tiers.",
"version": "18.0.1.0.0",
"category": "Tools",
"website": "https://github.com/OCA/server-ux",
"author": "ForgeFlow, Odoo Community Association (OCA)",
"license": "AGPL-3",
"depends": ["base_tier_validation"],
"data": [
"security/ir.model.access.csv",
"views/tier_definition_view.xml",
"wizards/authentication_wizard_view.xml",
],
"application": False,
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import tier_definition
from . import tier_review
from . import tier_validation
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class TierDefinition(models.Model):
_inherit = "tier.definition"

require_authentication = fields.Boolean(
help="If enabled, the user will be asked to authenticate "
"himself in order to validate or reject the tier.",
default=False,
)
13 changes: 13 additions & 0 deletions base_tier_validation_authentication_confirm/models/tier_review.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class TierReview(models.Model):
_inherit = "tier.review"

require_authentication = fields.Boolean(
related="definition_id.require_authentication", readonly=True
)
authentication_confirmed = fields.Boolean()
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import fields, models


class TierValidation(models.AbstractModel):
_inherit = "tier.validation"

require_authentication = fields.Boolean(compute="_compute_require_authentication")

def _compute_require_authentication(self):
for rec in self:
require_authentication = rec.review_ids.filtered(
lambda r: r.status in ("waiting", "pending")
and (self.env.user in r.reviewer_ids)
).mapped("require_authentication")
rec.require_authentication = True in require_authentication

def validate_tier(self):
self.ensure_one()
sequences = self._get_sequences_to_approve(self.env.user)
reviews = self.review_ids.filtered(
lambda x: x.sequence in sequences or x.approve_sequence_bypass
)
if not self.has_comment and self.require_authentication:
user_reviews = reviews.filtered(
lambda r: r.status == "pending" and (self.env.user in r.reviewer_ids)
)
return self._confirm_authentication("validate", user_reviews)
return super().validate_tier()

def reject_tier(self):
self.ensure_one()
sequences = self._get_sequences_to_approve(self.env.user)
reviews = self.review_ids.filtered(lambda x: x.sequence in sequences)
if not self.has_comment and self.require_authentication:
return self._confirm_authentication("reject", reviews)
return super().reject_tier()

def _confirm_authentication(self, validate_reject, reviews):
wizard = self.env.ref(
"base_tier_validation_authentication_confirm.view_authentication_confirm_wizard"
)
return {
"name": self.env._("Authentication Confirmation"),
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "authentication.wizard",
"views": [(wizard.id, "form")],
"view_id": wizard.id,
"target": "new",
"context": {
"default_res_id": self.id,
"default_res_model": self._name,
"default_review_ids": reviews.ids,
"default_validate_reject": validate_reject,
},
}
3 changes: 3 additions & 0 deletions base_tier_validation_authentication_confirm/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
To configure this module, you need to:

1. Go to *Settings \> Technical \> Tier Validations \> Tier
Definition \> Select one tier definition*.
2. Mark confirm password required field.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Arnau Cruz <[email protected]>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Allows to add a password confirmation to tier validation,
where the user must confirm his authentication in order to approve or reject the tier review.
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_authentication_wizard,access.authentication.wizard,model_authentication_wizard,base.group_user,1,1,1,1
Loading
Loading