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
142 changes: 70 additions & 72 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 @@ -70,16 +66,16 @@ To configure this module, you need to:

**Note:**

- If check *Notify Reviewers on Creation*, all possible reviewers will
be notified by email when this definition is triggered.
- If check *Notify reviewers on reaching pending* if you want to send a
notification when pending status is reached. This is usefull in a
approve by sequence scenario to only notify reviewers when it is their
turn in the sequence.
- If check *Comment*, reviewers can comment after click Validate or
Reject.
- If check *Approve by sequence*, reviewers is forced to review by
specified sequence.
- If check *Notify Reviewers on Creation*, all possible reviewers will
be notified by email when this definition is triggered.
- If check *Notify reviewers on reaching pending* if you want to send a
notification when pending status is reached. This is usefull in a
approve by sequence scenario to only notify reviewers when it is
their turn in the sequence.
- If check *Comment*, reviewers can comment after click Validate or
Reject.
- If check *Approve by sequence*, reviewers is forced to review by
specified sequence.

To configure Tier Validation Exceptions, you need to:

Expand All @@ -94,40 +90,42 @@ To configure Tier Validation Exceptions, you need to:

**Note:**

- If you don't create any exception, the Validated record will be
readonly and cannot be modified.
- If check *Write under Validation*, records will be able to be modified
only in the defined fields when the Validation process is ongoing.
- If check *Write after Validation*, records will be able to be modified
only in the defined fields when the Validation process is finished.
- If check *Write after Validation* and *Write under Validation*,
records will be able to be modified defined fields always.
- If you don't create any exception, the Validated record will be
readonly and cannot be modified.
- If check *Write under Validation*, records will be able to be
modified only in the defined fields when the Validation process is
ongoing.
- If check *Write after Validation*, records will be able to be
modified only in the defined fields when the Validation process is
finished.
- If check *Write after Validation* and *Write under Validation*,
records will be able to be modified defined fields always.

Known issues / Roadmap
======================

This is the list of known issues for this module. Any proposal for
improvement will be very valuable.

- **Issue:**
- **Issue:**

When using approve_sequence option in any tier.definition there can be
inconsistencies in the systray notifications.
When using approve_sequence option in any tier.definition there can
be inconsistencies in the systray notifications.

**Description:**
**Description:**

Field can_review in tier.review is used to filter out, in the systray
notifications, the reviews a user can approve. This can_review field
is updated **in the database** in method review_user_count, this can
make it very inconsistent for databases with a lot of users and
recurring updates that can change the expected behavior.
Field can_review in tier.review is used to filter out, in the systray
notifications, the reviews a user can approve. This can_review field
is updated **in the database** in method review_user_count, this can
make it very inconsistent for databases with a lot of users and
recurring updates that can change the expected behavior.

- **Migration to 15.0:**
- **Migration to 15.0:**

The parameter \_tier_validation_manual_config will become False, on
14.0, the default value is True, as the change is applied after the
migration. In order to use the new behavior we need to modify the
value on our expected model.
The parameter \_tier_validation_manual_config will become False, on
14.0, the default value is True, as the change is applied after the
migration. In order to use the new behavior we need to modify the
value on our expected model.

Changelog
=========
Expand All @@ -149,69 +147,69 @@ Migrated to Odoo 14.

Fixes:

- When using approve_sequence option in any tier.definition there can be
inconsistencies in the systray notifications
- When using approve_sequence, still not approve only the needed
sequence, but also other sequence for the same approver
- When using approve_sequence option in any tier.definition there can
be inconsistencies in the systray notifications
- When using approve_sequence, still not approve only the needed
sequence, but also other sequence for the same approver

12.0.3.3.1 (2019-12-02)
-----------------------

Fixes:

- Show comment on Reviews Table.
- Edit notification with approve_sequence.
- Show comment on Reviews Table.
- Edit notification with approve_sequence.

12.0.3.3.0 (2019-11-27)
-----------------------

New features:

- Add comment on Reviews Table.
- Approve by sequence.
- Add comment on Reviews Table.
- Approve by sequence.

12.0.3.2.1 (2019-11-26)
-----------------------

Fixes:

- Remove message_subscribe_users
- Remove message_subscribe_users

12.0.3.2.0 (2019-11-25)
-----------------------

New features:

- Notify reviewers
- Notify reviewers

12.0.3.1.0 (2019-07-08)
-----------------------

Fixes:

- Singleton error
- Singleton error

12.0.3.0.0 (2019-12-02)
-----------------------

Fixes:

- Edit Reviews Table
- Edit Reviews Table

12.0.2.1.0 (2019-05-29)
-----------------------

Fixes:

- Edit drop-down style width and position
- Edit drop-down style width and position

12.0.2.0.0 (2019-05-28)
-----------------------

New features:

- Pass parameters as functions.
- Add Systray.
- Pass parameters as functions.
- Add Systray.

12.0.1.0.0 (2019-02-18)
-----------------------
Expand Down Expand Up @@ -254,26 +252,26 @@ Authors
Contributors
------------

- Lois Rilo <[email protected]>
- Naglis Jonaitis <[email protected]>
- Adrià Gil Sorribes <[email protected]>
- Pimolnat Suntian <[email protected]>
- Pedro Gonzalez <[email protected]>
- Kitti U. <[email protected]>
- Saran Lim. <[email protected]>
- Carlos Lopez <[email protected]>
- Javier Colmeiro <[email protected]>
- bosd
- Evan Soh <[email protected]>
- Manuel Regidor <[email protected]>
- Eduardo de Miguel <[email protected]>
- `XCG Consulting <https://xcg-consulting.fr>`__:

- Houzéfa Abbasbhay

- Stefan Rijnhart <[email protected]>
- Kevin Khao <[email protected]>
- Do Anh Duy <[email protected]>
- Lois Rilo <[email protected]>
- Naglis Jonaitis <[email protected]>
- Adrià Gil Sorribes <[email protected]>
- Pimolnat Suntian <[email protected]>
- Pedro Gonzalez <[email protected]>
- Kitti U. <[email protected]>
- Saran Lim. <[email protected]>
- Carlos Lopez <[email protected]>
- Javier Colmeiro <[email protected]>
- bosd
- Evan Soh <[email protected]>
- Manuel Regidor <[email protected]>
- Eduardo de Miguel <[email protected]>
- `XCG Consulting <https://xcg-consulting.fr>`__:

- Houzéfa Abbasbhay

- Stefan Rijnhart <[email protected]>
- Kevin Khao <[email protected]>
- Do Anh Duy <[email protected]>

Other credits
-------------
Expand Down
2 changes: 1 addition & 1 deletion base_tier_validation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{
"name": "Base Tier Validation",
"summary": "Implement a validation process based on tiers.",
"version": "18.0.2.0.1",
"version": "18.0.2.1.0",
"development_status": "Mature",
"maintainers": ["LoisRForgeFlow"],
"category": "Tools",
Expand Down
79 changes: 79 additions & 0 deletions base_tier_validation/migrations/18.0.2.1.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Copyright 2025 Tecnativa - Víctor Martínez
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openupgradelib import openupgrade


@openupgrade.migrate()
def migrate(env, version):
env.cr.execute(
"""
SELECT imf.model
FROM ir_model_fields AS imf
WHERE imf.name = 'review_ids'
AND imf.ttype = 'one2many'
AND imf.model != 'tier.validation'
"""
)
for (model_name,) in env.cr.fetchall():
table_name = model_name.replace(".", "_")
# validation_status column
if not openupgrade.column_exists(env.cr, table_name, "validation_status"):
openupgrade.logged_query(
env.cr,
f"""
ALTER TABLE {table_name}
ADD COLUMN IF NOT EXISTS validation_status VARCHAR
""",
)
openupgrade.logged_query(
env.cr,
f"""
UPDATE {table_name} SET validation_status = 'no'
""",
)
openupgrade.logged_query(
env.cr,
f"""
UPDATE {table_name} SET validation_status = 'rejected'
WHERE validation_status = 'no' AND id IN (
SELECT DISTINCT(tr.res_id)
FROM tier_review AS tr
WHERE tr.model = '{model_name}' AND tr.status = 'rejected'
)
""",
)
openupgrade.logged_query(
env.cr,
f"""
UPDATE {table_name} SET validation_status = 'pending'
WHERE validation_status = 'no' AND id IN (
SELECT DISTINCT(tr.res_id)
FROM tier_review AS tr
WHERE tr.model = '{model_name}' AND tr.status = 'pending'
)
""",
)
openupgrade.logged_query(
env.cr,
f"""
UPDATE {table_name} SET validation_status = 'waiting'
WHERE validation_status = 'no' AND id IN (
SELECT DISTINCT(tr.res_id)
FROM tier_review AS tr
WHERE tr.model = '{model_name}' AND tr.status = 'waiting'
)
""",
)
openupgrade.logged_query(
env.cr,
f"""
UPDATE {table_name} SET validation_status = 'validated'
WHERE validation_status = 'no' AND id IN (
SELECT DISTINCT(tr.res_id)
FROM tier_review AS tr
WHERE tr.model = '{model_name}'
AND tr.status IN ('approved', 'forwarded')
)
""",
)
2 changes: 1 addition & 1 deletion base_tier_validation/models/res_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def review_user_count(self):
if tier_review and hasattr(Model, "can_review"):
records_domain = [
("id", "in", tier_review.mapped("res_id")),
("rejected", "=", False),
("validation_status", "!=", "rejected"),
("can_review", "=", True),
]
records = (
Expand Down
Loading