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
12 changes: 7 additions & 5 deletions base_tier_validation/README.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
.. 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
====================
Expand All @@ -17,7 +13,7 @@ Base Tier Validation
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
:target: https://odoo-community.org/page/development-status
:alt: Mature
.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
.. |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
Expand Down Expand Up @@ -80,6 +76,11 @@ To configure this module, you need to:
Reject.
- If check *Approve by sequence*, reviewers is forced to review by
specified sequence.
- In *More Options* tab, you can configure the *Restart Validation
Group* to control which users can restart the validation process. By
default, all internal user can restart validations. The restart button
will be hidden for users who don't have all the groups specified in
this field for all the reviews to restart.

To configure Tier Validation Exceptions, you need to:

Expand Down Expand Up @@ -272,6 +273,7 @@ Contributors
- Houzéfa Abbasbhay

- Stefan Rijnhart <stefan@opener.amsterdam>
- Camille Morand <camille.morand@camptocamp.com>

Maintainers
-----------
Expand Down
6 changes: 6 additions & 0 deletions base_tier_validation/models/tier_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@ def _get_tier_validation_model_names(self):
help="Bypassed (auto validated), if previous tier was validated "
"by same reviewer",
)
restart_validation_group_id = fields.Many2one(
comodel_name="res.groups",
required=True,
default=lambda self: self.env.ref("base.group_user", raise_if_not_found=False),
help="Group allowed to restart the validation process.",
)

@api.onchange("review_type")
def onchange_review_type(self):
Expand Down
3 changes: 3 additions & 0 deletions base_tier_validation/models/tier_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ class TierReview(models.Model):
related="definition_id.approve_sequence_bypass", readonly=True
)
last_reminder_date = fields.Datetime(readonly=True)
restart_validation_group_id = fields.Many2one(
related="definition_id.restart_validation_group_id"
)

@api.depends("status")
def _compute_display_status(self):
Expand Down
25 changes: 25 additions & 0 deletions base_tier_validation/models/tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ class TierValidation(models.AbstractModel):
)
next_review = fields.Char(compute="_compute_next_review")
hide_reviews = fields.Boolean(compute="_compute_hide_reviews")
can_restart_validation = fields.Boolean(
compute="_compute_can_restart_validation",
help="Whether the current user can restart the validation process.",
)

def _compute_has_comment(self):
for rec in self:
Expand Down Expand Up @@ -247,6 +251,22 @@ def _compute_hide_reviews(self):
for rec in self:
rec.hide_reviews = rec[self._state_field] not in self._state_from

@api.depends("review_ids.restart_validation_group_id")
@api.depends_context("uid")
def _compute_can_restart_validation(self):
"""Check if the current user can restart validation.
User can restart if they belong to all the restart validation groups
defined in the implied tier reviews."""
for rec in self:
restart_groups_xmlids = (
rec.review_ids.restart_validation_group_id.get_external_id()
)
# Check if user belongs to all of these groups
rec.can_restart_validation = all(
self.env.user.has_group(group_xmlid)
for group_xmlid in restart_groups_xmlids.values()
)

def _compute_need_validation(self):
for rec in self:
if isinstance(rec.id, models.NewId):
Expand Down Expand Up @@ -800,6 +820,11 @@ def _notify_restarted_review(self):

def restart_validation(self):
for rec in self:
# Check if user has permission to restart validation
if not rec.can_restart_validation:
raise ValidationError(
_("You don't have permission to restart the validation process.")
)
partners_to_notify_ids = False
if getattr(rec, self._state_field) in self._state_from:
to_update_counter = (
Expand Down
5 changes: 5 additions & 0 deletions base_tier_validation/readme/CONFIGURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ To configure this module, you need to:
Reject.
- If check *Approve by sequence*, reviewers is forced to review by
specified sequence.
- In *More Options* tab, you can configure the *Restart Validation Group*
to control which users can restart the validation process. By default,
all internal user can restart validations. The restart button will be
hidden for users who don't have all the groups specified in this field
for all the reviews to restart.

To configure Tier Validation Exceptions, you need to:

Expand Down
1 change: 1 addition & 0 deletions base_tier_validation/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
- [XCG Consulting](https://xcg-consulting.fr):
- Houzéfa Abbasbhay
- Stefan Rijnhart \<<stefan@opener.amsterdam>\>
- Camille Morand \<<camille.morand@camptocamp.com>\>
66 changes: 33 additions & 33 deletions base_tier_validation/static/description/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils: https://docutils.sourceforge.io/" />
<title>README.rst</title>
<title>Base Tier Validation</title>
<style type="text/css">

/*
Expand Down Expand Up @@ -360,21 +360,16 @@
</style>
</head>
<body>
<div class="document">
<div class="document" id="base-tier-validation">
<h1 class="title">Base Tier Validation</h1>


<a class="reference external image-reference" href="https://odoo-community.org/get-involved?utm_source=readme">
<img alt="Odoo Community Association" src="https://odoo-community.org/readme-banner-image" />
</a>
<div class="section" id="base-tier-validation">
<h1>Base Tier Validation</h1>
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:7e2d5775a6effab39ddf01beb39fa2c765a03961d0bff49176b16dacf089e829
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/license-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-ux/tree/17.0/base_tier_validation"><img alt="OCA/server-ux" src="https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-ux-17-0/server-ux-17-0-base_tier_validation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-ux&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Mature" src="https://img.shields.io/badge/maturity-Mature-brightgreen.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/server-ux/tree/17.0/base_tier_validation"><img alt="OCA/server-ux" src="https://img.shields.io/badge/github-OCA%2Fserver--ux-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/server-ux-17-0/server-ux-17-0-base_tier_validation"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/server-ux&amp;target_branch=17.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
<p>Validating some operations is a common need across different areas in a
company and sometimes it also involves several people and stages in the
process. With this module you will be able to define your custom
Expand Down Expand Up @@ -425,7 +420,7 @@ <h1>Base Tier Validation</h1>
</ul>
</div>
<div class="section" id="configuration">
<h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
<h1><a class="toc-backref" href="#toc-entry-1">Configuration</a></h1>
<p>To configure this module, you need to:</p>
<ol class="arabic simple">
<li>Go to <em>Settings &gt; Technical &gt; Tier Validations &gt; Tier Definition</em>.</li>
Expand All @@ -444,6 +439,11 @@ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
Reject.</li>
<li>If check <em>Approve by sequence</em>, reviewers is forced to review by
specified sequence.</li>
<li>In <em>More Options</em> tab, you can configure the <em>Restart Validation
Group</em> to control which users can restart the validation process. By
default, all internal user can restart validations. The restart button
will be hidden for users who don’t have all the groups specified in
this field for all the reviews to restart.</li>
</ul>
<p>To configure Tier Validation Exceptions, you need to:</p>
<ol class="arabic simple">
Expand All @@ -469,7 +469,7 @@ <h2><a class="toc-backref" href="#toc-entry-1">Configuration</a></h2>
</ul>
</div>
<div class="section" id="known-issues-roadmap">
<h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
<h1><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h1>
<p>This is the list of known issues for this module. Any proposal for
improvement will be very valuable.</p>
<ul>
Expand All @@ -492,19 +492,19 @@ <h2><a class="toc-backref" href="#toc-entry-2">Known issues / Roadmap</a></h2>
</ul>
</div>
<div class="section" id="changelog">
<h2><a class="toc-backref" href="#toc-entry-3">Changelog</a></h2>
<h1><a class="toc-backref" href="#toc-entry-3">Changelog</a></h1>
<div class="section" id="section-1">
<h3><a class="toc-backref" href="#toc-entry-4">17.0.1.0.0 (2024-01-10)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-4">17.0.1.0.0 (2024-01-10)</a></h2>
<p>Migrated to Odoo 17. Merged module with tier_validation_waiting. To
support sending messages in a validation sequence when it is their turn
to validate.</p>
</div>
<div class="section" id="section-2">
<h3><a class="toc-backref" href="#toc-entry-5">14.0.1.0.0 (2020-11-19)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-5">14.0.1.0.0 (2020-11-19)</a></h2>
<p>Migrated to Odoo 14.</p>
</div>
<div class="section" id="section-3">
<h3><a class="toc-backref" href="#toc-entry-6">13.0.1.2.2 (2020-08-30)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-6">13.0.1.2.2 (2020-08-30)</a></h2>
<p>Fixes:</p>
<ul class="simple">
<li>When using approve_sequence option in any tier.definition there can be
Expand All @@ -514,99 +514,99 @@ <h3><a class="toc-backref" href="#toc-entry-6">13.0.1.2.2 (2020-08-30)</a></h3>
</ul>
</div>
<div class="section" id="section-4">
<h3><a class="toc-backref" href="#toc-entry-7">12.0.3.3.1 (2019-12-02)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-7">12.0.3.3.1 (2019-12-02)</a></h2>
<p>Fixes:</p>
<ul class="simple">
<li>Show comment on Reviews Table.</li>
<li>Edit notification with approve_sequence.</li>
</ul>
</div>
<div class="section" id="section-5">
<h3><a class="toc-backref" href="#toc-entry-8">12.0.3.3.0 (2019-11-27)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-8">12.0.3.3.0 (2019-11-27)</a></h2>
<p>New features:</p>
<ul class="simple">
<li>Add comment on Reviews Table.</li>
<li>Approve by sequence.</li>
</ul>
</div>
<div class="section" id="section-6">
<h3><a class="toc-backref" href="#toc-entry-9">12.0.3.2.1 (2019-11-26)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-9">12.0.3.2.1 (2019-11-26)</a></h2>
<p>Fixes:</p>
<ul class="simple">
<li>Remove message_subscribe_users</li>
</ul>
</div>
<div class="section" id="section-7">
<h3><a class="toc-backref" href="#toc-entry-10">12.0.3.2.0 (2019-11-25)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-10">12.0.3.2.0 (2019-11-25)</a></h2>
<p>New features:</p>
<ul class="simple">
<li>Notify reviewers</li>
</ul>
</div>
<div class="section" id="section-8">
<h3><a class="toc-backref" href="#toc-entry-11">12.0.3.1.0 (2019-07-08)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-11">12.0.3.1.0 (2019-07-08)</a></h2>
<p>Fixes:</p>
<ul class="simple">
<li>Singleton error</li>
</ul>
</div>
<div class="section" id="section-9">
<h3><a class="toc-backref" href="#toc-entry-12">12.0.3.0.0 (2019-12-02)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-12">12.0.3.0.0 (2019-12-02)</a></h2>
<p>Fixes:</p>
<ul class="simple">
<li>Edit Reviews Table</li>
</ul>
</div>
<div class="section" id="section-10">
<h3><a class="toc-backref" href="#toc-entry-13">12.0.2.1.0 (2019-05-29)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-13">12.0.2.1.0 (2019-05-29)</a></h2>
<p>Fixes:</p>
<ul class="simple">
<li>Edit drop-down style width and position</li>
</ul>
</div>
<div class="section" id="section-11">
<h3><a class="toc-backref" href="#toc-entry-14">12.0.2.0.0 (2019-05-28)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-14">12.0.2.0.0 (2019-05-28)</a></h2>
<p>New features:</p>
<ul class="simple">
<li>Pass parameters as functions.</li>
<li>Add Systray.</li>
</ul>
</div>
<div class="section" id="section-12">
<h3><a class="toc-backref" href="#toc-entry-15">12.0.1.0.0 (2019-02-18)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-15">12.0.1.0.0 (2019-02-18)</a></h2>
<p>Migrated to Odoo 12.</p>
</div>
<div class="section" id="section-13">
<h3><a class="toc-backref" href="#toc-entry-16">11.0.1.0.0 (2018-05-09)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-16">11.0.1.0.0 (2018-05-09)</a></h2>
<p>Migrated to Odoo 11.</p>
</div>
<div class="section" id="section-14">
<h3><a class="toc-backref" href="#toc-entry-17">10.0.1.0.0 (2018-03-26)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-17">10.0.1.0.0 (2018-03-26)</a></h2>
<p>Migrated to Odoo 10.</p>
</div>
<div class="section" id="section-15">
<h3><a class="toc-backref" href="#toc-entry-18">9.0.1.0.0 (2017-12-02)</a></h3>
<h2><a class="toc-backref" href="#toc-entry-18">9.0.1.0.0 (2017-12-02)</a></h2>
<p>First version.</p>
</div>
</div>
<div class="section" id="bug-tracker">
<h2><a class="toc-backref" href="#toc-entry-19">Bug Tracker</a></h2>
<h1><a class="toc-backref" href="#toc-entry-19">Bug Tracker</a></h1>
<p>Bugs are tracked on <a class="reference external" href="https://github.com/OCA/server-ux/issues">GitHub Issues</a>.
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
<a class="reference external" href="https://github.com/OCA/server-ux/issues/new?body=module:%20base_tier_validation%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**">feedback</a>.</p>
<p>Do not contact contributors directly about support or help with technical issues.</p>
</div>
<div class="section" id="credits">
<h2><a class="toc-backref" href="#toc-entry-20">Credits</a></h2>
<h1><a class="toc-backref" href="#toc-entry-20">Credits</a></h1>
<div class="section" id="authors">
<h3><a class="toc-backref" href="#toc-entry-21">Authors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-21">Authors</a></h2>
<ul class="simple">
<li>ForgeFlow</li>
</ul>
</div>
<div class="section" id="contributors">
<h3><a class="toc-backref" href="#toc-entry-22">Contributors</a></h3>
<h2><a class="toc-backref" href="#toc-entry-22">Contributors</a></h2>
<ul class="simple">
<li>Lois Rilo &lt;<a class="reference external" href="mailto:lois.rilo&#64;forgeflow.com">lois.rilo&#64;forgeflow.com</a>&gt;</li>
<li>Naglis Jonaitis &lt;<a class="reference external" href="mailto:naglis&#64;versada.eu">naglis&#64;versada.eu</a>&gt;</li>
Expand All @@ -626,10 +626,11 @@ <h3><a class="toc-backref" href="#toc-entry-22">Contributors</a></h3>
</ul>
</li>
<li>Stefan Rijnhart &lt;<a class="reference external" href="mailto:stefan&#64;opener.amsterdam">stefan&#64;opener.amsterdam</a>&gt;</li>
<li>Camille Morand &lt;<a class="reference external" href="mailto:camille.morand&#64;camptocamp.com">camille.morand&#64;camptocamp.com</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-23">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-23">Maintainers</a></h2>
<p>This module is maintained by the OCA.</p>
<a class="reference external image-reference" href="https://odoo-community.org">
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
Expand All @@ -644,6 +645,5 @@ <h3><a class="toc-backref" href="#toc-entry-23">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
3 changes: 2 additions & 1 deletion base_tier_validation/templates/tier_validation_templates.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<button
name="restart_validation"
string="Restart Validation"
invisible="not review_ids or hide_reviews"
invisible="not review_ids or hide_reviews or not can_restart_validation"
type="object"
/>
</div>
Expand All @@ -22,6 +22,7 @@
<field name="hide_reviews" invisible="1" />
<field name="need_validation" invisible="1" />
<field name="validation_status" invisible="1" />
<field name="can_restart_validation" invisible="1" />
<div
class="alert alert-warning"
role="alert"
Expand Down
Loading