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
6 changes: 1 addition & 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
1 change: 1 addition & 0 deletions base_tier_validation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"views/tier_review_view.xml",
"views/tier_validation_exception_view.xml",
"wizard/comment_wizard_view.xml",
"wizard/password_wizard_view.xml",
"templates/tier_validation_templates.xml",
],
"assets": {
Expand Down
4 changes: 4 additions & 0 deletions base_tier_validation/models/tier_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ def _get_tier_validation_model_names(self):
help="Bypassed (auto validated), if previous tier was validated "
"by same reviewer",
)
require_password = fields.Boolean(
help="If checked, the user will be asked to enter "
"the password to validate the tier.",
)

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

@api.depends("status")
def _compute_display_status(self):
Expand Down
33 changes: 33 additions & 0 deletions base_tier_validation/models/tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ class TierValidation(models.AbstractModel):
)
next_review = fields.Char(compute="_compute_next_review")
hide_reviews = fields.Boolean(compute="_compute_hide_reviews")
require_password = fields.Boolean(compute="_compute_require_password")

def _compute_require_password(self):
for rec in self:
require_password = rec.review_ids.filtered(
lambda r: r.status == "pending" and (self.env.user in r.reviewer_ids)
).mapped("require_password")
rec.require_password = True in require_password

def _compute_has_comment(self):
for rec in self:
Expand Down Expand Up @@ -623,6 +631,24 @@ def _add_comment(self, validate_reject, reviews):
},
}

def _confirm_password(self, validate_reject, reviews):
wizard = self.env.ref("base_tier_validation.view_password_confirm_wizard")
return {
"name": self.env._("Password Confirmation"),
"type": "ir.actions.act_window",
"view_mode": "form",
"res_model": "password.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,
},
}

def validate_tier(self):
self.ensure_one()
sequences = self._get_sequences_to_approve(self.env.user)
Expand All @@ -634,6 +660,11 @@ def validate_tier(self):
lambda r: r.status == "pending" and (self.env.user in r.reviewer_ids)
)
return self._add_comment("validate", user_reviews)
elif self.require_password:
user_reviews = reviews.filtered(
lambda r: r.status == "pending" and (self.env.user in r.reviewer_ids)
)
return self._confirm_password("validate", user_reviews)
self._validate_tier(reviews)
self._update_counter({"review_deleted": True})

Expand All @@ -643,6 +674,8 @@ def reject_tier(self):
reviews = self.review_ids.filtered(lambda x: x.sequence in sequences)
if self.has_comment:
return self._add_comment("reject", reviews)
elif self.require_password:
return self._confirm_password("reject", reviews)
self._rejected_tier(reviews)
self._update_counter({"review_deleted": True})

Expand Down
1 change: 1 addition & 0 deletions base_tier_validation/security/ir.model.access.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ access_tier_review,access.tier.review,model_tier_review,base.group_user,1,1,1,1
access_tier_definition_all,tier.definition.all,model_tier_definition,base.group_user,1,0,0,0
access_tier_definition_settings,tier.definition.settings,model_tier_definition,base.group_erp_manager,1,1,1,1
access_comment_wizard,access.comment.wizard,model_comment_wizard,base.group_user,1,1,1,1
access_password_wizard,access.password.wizard,model_password_wizard,base.group_user,1,1,1,1
access_tier_validation_exceptions_all,tier.validation.exceptions,model_tier_validation_exception,base.group_user,1,0,0,0
access_tier_validation_exceptions_settings,tier.validation.exceptions,model_tier_validation_exception,base.group_system,1,1,1,1
62 changes: 28 additions & 34 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:6d11975caf64405a5a43026ff242109052744ce42ab068f3e50f93dd016d1208
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<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/18.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-18-0/server-ux-18-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=18.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/18.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-18-0/server-ux-18-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=18.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 @@ -426,7 +421,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 Down Expand Up @@ -470,7 +465,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 @@ -493,19 +488,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 @@ -515,99 +510,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:%2018.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 @@ -632,12 +627,12 @@ <h3><a class="toc-backref" href="#toc-entry-22">Contributors</a></h3>
</ul>
</div>
<div class="section" id="other-credits">
<h3><a class="toc-backref" href="#toc-entry-23">Other credits</a></h3>
<h2><a class="toc-backref" href="#toc-entry-23">Other credits</a></h2>
<p>The migration of this module from 17.0 to 18.0 was financially supported
by Camptocamp.</p>
</div>
<div class="section" id="maintainers">
<h3><a class="toc-backref" href="#toc-entry-24">Maintainers</a></h3>
<h2><a class="toc-backref" href="#toc-entry-24">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 @@ -652,6 +647,5 @@ <h3><a class="toc-backref" href="#toc-entry-24">Maintainers</a></h3>
</div>
</div>
</div>
</div>
</body>
</html>
Loading