Skip to content
Merged
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ addon | version | maintainers | summary
[base_substate](base_substate/) | 18.0.1.0.1 | | Base Sub State
[base_technical_features](base_technical_features/) | 18.0.1.0.2 | | Access to technical features without activating debug mode
[base_tier_validation](base_tier_validation/) | 18.0.3.1.2 | <a href='https://github.com/LoisRForgeFlow'><img src='https://github.com/LoisRForgeFlow.png' width='32' height='32' style='border-radius:50%;' alt='LoisRForgeFlow'/></a> | Implement a validation process based on tiers.
[base_tier_validation_confirm_auth](base_tier_validation_confirm_auth/) | 18.0.1.0.0 | | Authentication confirmation for base tiers.
[base_tier_validation_correction](base_tier_validation_correction/) | 18.0.1.0.0 | <a href='https://github.com/kittiu'><img src='https://github.com/kittiu.png' width='32' height='32' style='border-radius:50%;' alt='kittiu'/></a> | Correct tier.review data after it has been created.
[base_tier_validation_formula](base_tier_validation_formula/) | 18.0.1.0.0 | | Formulas for Base tier validation
[base_tier_validation_forward](base_tier_validation_forward/) | 18.0.2.0.1 | <a href='https://github.com/kittiu'><img src='https://github.com/kittiu.png' width='32' height='32' style='border-radius:50%;' alt='kittiu'/></a> | Forward option for base tiers
Expand Down
91 changes: 91 additions & 0 deletions base_tier_validation_confirm_auth/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================================
Base Tier Validation Confirm Auth
=================================

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

.. |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/license-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_confirm_auth
: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_confirm_auth
: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 an authentication check 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 "Require Authentication" 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_confirm_auth%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 arnau.cruz@forgeflow.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.

This module is part of the `OCA/server-ux <https://github.com/OCA/server-ux/tree/18.0/base_tier_validation_confirm_auth>`_ 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_confirm_auth/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
17 changes: 17 additions & 0 deletions base_tier_validation_confirm_auth/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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 Confirm Auth",
"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": [
"views/tier_definition_view.xml",
],
"application": False,
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * base_tier_validation_confirm_auth
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 18.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: base_tier_validation_confirm_auth
#: model:ir.model,name:base_tier_validation_confirm_auth.model_comment_wizard
msgid "Comment Wizard"
msgstr ""

#. module: base_tier_validation_confirm_auth
#: model:ir.model.fields,help:base_tier_validation_confirm_auth.field_tier_definition__require_authentication
#: model:ir.model.fields,help:base_tier_validation_confirm_auth.field_tier_review__require_authentication
msgid ""
"If enabled, the user will be asked to authenticate himself in order to "
"validate or reject the tier."
msgstr ""

#. module: base_tier_validation_confirm_auth
#: model:ir.model.fields,field_description:base_tier_validation_confirm_auth.field_tier_definition__require_authentication
#: model:ir.model.fields,field_description:base_tier_validation_confirm_auth.field_tier_review__require_authentication
#: model:ir.model.fields,field_description:base_tier_validation_confirm_auth.field_tier_validation__require_authentication
msgid "Require Authentication"
msgstr ""

#. module: base_tier_validation_confirm_auth
#. odoo-python
#: code:addons/base_tier_validation_confirm_auth/models/res_users.py:0
msgid "Security Control"
msgstr ""

#. module: base_tier_validation_confirm_auth
#. odoo-python
#: code:addons/base_tier_validation_confirm_auth/models/res_users.py:0
msgid "This method can only be accessed over HTTP"
msgstr ""

#. module: base_tier_validation_confirm_auth
#: model:ir.model,name:base_tier_validation_confirm_auth.model_tier_definition
msgid "Tier Definition"
msgstr ""

#. module: base_tier_validation_confirm_auth
#: model:ir.model,name:base_tier_validation_confirm_auth.model_tier_review
msgid "Tier Review"
msgstr ""

#. module: base_tier_validation_confirm_auth
#: model:ir.model,name:base_tier_validation_confirm_auth.model_tier_validation
msgid "Tier Validation (abstract)"
msgstr ""
4 changes: 4 additions & 0 deletions base_tier_validation_confirm_auth/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import tier_definition
from . import tier_review
from . import tier_validation
from . import res_users
57 changes: 57 additions & 0 deletions base_tier_validation_confirm_auth/models/res_users.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2026 ForgeFlow S.L. (https://www.forgeflow.com)
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

import json
from functools import wraps

from odoo import _
from odoo.exceptions import UserError
from odoo.http import request


def _jsonable(o):
try:
json.dumps(o)
except TypeError:
return False
else:
return True


def check_authentication(fn):
@wraps(fn)
def wrapped(self, *args, **kwargs):
if not request:
raise UserError(_("This method can only be accessed over HTTP"))

if self.env.context.get("identity_checked"):
return fn(self, *args, **kwargs)

ctx = self.env.context.copy()
ctx["identity_checked"] = True

safe_context = {k: v for k, v in ctx.items() if _jsonable(v)}

w = (
self.sudo()
.env["res.users.identitycheck"]
.create(
{
"request": json.dumps(
[safe_context, self._name, self.ids, fn.__name__, args, kwargs]
)
}
)
)

return {
"type": "ir.actions.act_window",
"res_model": "res.users.identitycheck",
"res_id": w.id,
"name": _("Security Control"),
"target": "new",
"views": [(False, "form")],
}

wrapped.__has_check_identity = True
return wrapped
14 changes: 14 additions & 0 deletions base_tier_validation_confirm_auth/models/tier_definition.py
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,
)
12 changes: 12 additions & 0 deletions base_tier_validation_confirm_auth/models/tier_review.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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
)
40 changes: 40 additions & 0 deletions base_tier_validation_confirm_auth/models/tier_validation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# 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

from .res_users import check_authentication


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()
if not self.has_comment and self.require_authentication:
return self._validate_tier_with_identity_check()
return super().validate_tier()

def reject_tier(self):
self.ensure_one()
if not self.has_comment and self.require_authentication:
return self._reject_tier_with_identity_check()
return super().reject_tier()

@check_authentication
def _validate_tier_with_identity_check(self):
return super().validate_tier()

@check_authentication
def _reject_tier_with_identity_check(self):
return super().reject_tier()
3 changes: 3 additions & 0 deletions base_tier_validation_confirm_auth/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
5 changes: 5 additions & 0 deletions base_tier_validation_confirm_auth/readme/CONFIGURE.md
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 "Require Authentication" field.
1 change: 1 addition & 0 deletions base_tier_validation_confirm_auth/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Arnau Cruz <arnau.cruz@forgeflow.com>
2 changes: 2 additions & 0 deletions base_tier_validation_confirm_auth/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Allows to add an authentication check to tier validation,
where the user must confirm his authentication in order to approve or reject the tier review.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading