From 6c8ea001e96540890f561ae6b8f3aa47525c33f6 Mon Sep 17 00:00:00 2001
From: bosd <5e2fd43-d292-4c90-9d1f-74ff3436329a@anonaddy.me>
Date: Tue, 12 May 2026 22:01:53 +0200
Subject: [PATCH] [IMP] base_tier_validation: name the assignee in the "to
validate" banner
The yellow banner shown above a tier-validated document used to read
This Record needs to be validated.
which is generic in two ways: it does not say which model the
record belongs to, and -- more importantly -- it does not say *who*
is expected to act. Users in our rollout consistently asked
"who's holding this up?" even though that information already
exists on the underlying ``tier.review.todo_by``.
Rework ``_get_to_validate_message`` to surface the pending tier's
``todo_by`` inline so the banner reads, for example:
Pending validation by John
Pending validation by Group Accountants
Pending validation by Mike, Jane (and 2 more)
When no review has reached ``pending`` yet (e.g. the defensive
``waiting`` edge case, or downstream code calling the method on a
fresh record), fall back to the existing model-name phrasing:
This Sale Order needs to be validated.
Plumbing:
- ``_compute_to_validate_message`` now depends on
``review_ids.status`` and ``review_ids.todo_by`` in addition to
``validation_status``, so the banner refreshes when a tier reaches
pending or when the assignee changes.
- The ``tier_validation_label`` template now actually renders the
``to_validate_message`` field (long-defined on the abstract model
but never previously wired into the template, which carried its
own hardcoded text).
- ``todo_by`` is reused so every review type -- individual user,
group, ``res.users`` / ``res.groups`` field, Python expression --
is handled by one path and stays consistent with the Reviews
table below.
Tests:
- ``test_19c_to_validate_message_names_assignee`` -- after a tier
reaches ``pending``, the banner contains the assignee and not the
generic phrasing.
- ``test_19d_to_validate_message_falls_back_when_no_pending`` --
with no pending review, the banner falls back to the model-name
phrasing.
---
base_tier_validation/README.rst | 17 +++
.../models/tier_validation.py | 31 +++-
base_tier_validation/readme/HISTORY.md | 17 +++
.../static/description/index.html | 136 ++++++++++--------
.../templates/tier_validation_templates.xml | 46 +++---
.../tests/test_tier_validation.py | 49 +++++++
6 files changed, 211 insertions(+), 85 deletions(-)
diff --git a/base_tier_validation/README.rst b/base_tier_validation/README.rst
index 5c97d71c7..a0a527df2 100644
--- a/base_tier_validation/README.rst
+++ b/base_tier_validation/README.rst
@@ -125,6 +125,23 @@ improvement will be very valuable.
Changelog
=========
+19.0.1.0.4 (2026-05-13)
+-----------------------
+
+UI improvement:
+
+- The "needs to be validated" banner shown above tier-validated
+ documents now surfaces *who* is expected to act, when known. Reads
+ "Pending validation by John" or "Pending validation by Group
+ Accountants" instead of the generic "This Record needs to be
+ validated", with a fallback to the model-name phrasing for the
+ defensive edge case where no review has reached ``pending`` yet.
+ Reuses ``tier.review.todo_by`` so every review type (individual user,
+ group, ``res.users`` / ``res.groups`` field) is handled uniformly. The
+ banner template now reads from the long-standing
+ ``to_validate_message`` Html field, which was previously defined on
+ the model but never rendered.
+
19.0.1.0.1 (2026-05-12)
-----------------------
diff --git a/base_tier_validation/models/tier_validation.py b/base_tier_validation/models/tier_validation.py
index 29896f80b..782cca05d 100644
--- a/base_tier_validation/models/tier_validation.py
+++ b/base_tier_validation/models/tier_validation.py
@@ -172,11 +172,32 @@ def _get_to_validate_message_name(self):
return self._description
def _get_to_validate_message(self):
- return f""" {
- self.env._(
- "This %s needs to be validated", self._get_to_validate_message_name()
+ """Build the contextual "needs to be validated" banner body.
+
+ When at least one review has reached ``pending`` and carries a
+ ``todo_by`` label (i.e. the assignee is known -- a user, a group
+ or a field-based reviewer), surface it inline so the reader can
+ see at a glance *who* is expected to act next, not just *that*
+ action is needed.
+
+ Falls back to the model-name phrasing -- "This Sale Order needs
+ to be validated" -- when no pending review is available yet
+ (defensive: e.g. the ``waiting`` edge state, or downstream code
+ that calls this on a fresh record).
+ """
+ icon = ''
+ pending = self.review_ids.filtered(lambda r: r.status == "pending")[:1]
+ if pending and pending.todo_by:
+ return self.env._(
+ "%(icon)s Pending validation by %(todo_by)s",
+ icon=icon,
+ todo_by=pending.todo_by,
)
- }"""
+ return self.env._(
+ "%(icon)s This %(model_name)s needs to be validated",
+ icon=icon,
+ model_name=self._get_to_validate_message_name(),
+ )
def _get_validated_message(self):
msg = f""" {
@@ -190,7 +211,7 @@ def _get_rejected_message(self):
}"""
return self.validation_status == "rejected" and msg or ""
- @api.depends("validation_status")
+ @api.depends("validation_status", "review_ids.status", "review_ids.todo_by")
def _compute_to_validate_message(self):
for rec in self:
rec.to_validate_message = rec._get_to_validate_message()
diff --git a/base_tier_validation/readme/HISTORY.md b/base_tier_validation/readme/HISTORY.md
index 740cd6ca2..d0d5ab671 100644
--- a/base_tier_validation/readme/HISTORY.md
+++ b/base_tier_validation/readme/HISTORY.md
@@ -1,3 +1,20 @@
+## 19.0.1.0.4 (2026-05-13)
+
+UI improvement:
+
+- The "needs to be validated" banner shown above tier-validated
+ documents now surfaces *who* is expected to act, when known.
+ Reads "Pending validation by John" or "Pending validation by
+ Group Accountants" instead of the generic
+ "This Record needs to be validated", with a fallback to the
+ model-name phrasing for the defensive edge case where no review
+ has reached ``pending`` yet. Reuses ``tier.review.todo_by`` so
+ every review type (individual user, group, ``res.users`` /
+ ``res.groups`` field) is handled uniformly. The banner template
+ now reads from the long-standing ``to_validate_message`` Html
+ field, which was previously defined on the model but never
+ rendered.
+
## 19.0.1.0.1 (2026-05-12)
Fixes:
diff --git a/base_tier_validation/static/description/index.html b/base_tier_validation/static/description/index.html
index 8d3911153..3be2d110c 100644
--- a/base_tier_validation/static/description/index.html
+++ b/base_tier_validation/static/description/index.html
@@ -398,30 +398,31 @@
Base Tier Validation
Configuration
Known issues / Roadmap
Changelog
-Bug Tracker
-Credits
@@ -490,7 +491,24 @@
-
+
+
UI improvement:
+
+- The “needs to be validated” banner shown above tier-validated
+documents now surfaces who is expected to act, when known. Reads
+“Pending validation by John” or “Pending validation by Group
+Accountants” instead of the generic “This Record needs to be
+validated”, with a fallback to the model-name phrasing for the
+defensive edge case where no review has reached pending yet.
+Reuses tier.review.todo_by so every review type (individual user,
+group, res.users / res.groups field) is handled uniformly. The
+banner template now reads from the long-standing
+to_validate_message Html field, which was previously defined on
+the model but never rendered.
+
+
+
+
Fixes:
- Restore auto-promotion of the lowest-sequence review to pending
@@ -512,18 +530,18 @@
subtype_ids explicitly (mirroring _notify_review_requested).
-
-
+
+
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.
-
-
+
-
-
+
+
Fixes:
- When using approve_sequence option in any tier.definition there can be
@@ -532,84 +550,84 @@
sequence, but also other sequence for the same approver
-
-
+
+
Fixes:
- Show comment on Reviews Table.
- Edit notification with approve_sequence.
-
-
+
+
New features:
- Add comment on Reviews Table.
- Approve by sequence.
-
-
+
+
Fixes:
- Remove message_subscribe_users
-
-
+
-
-
+
-
-
+
-
-
+
+
Fixes:
- Edit drop-down style width and position
-
-
+
+
New features:
- Pass parameters as functions.
- Add Systray.
-
-
+
-
-
+
-
-
+
-
-
+
Bugs are tracked on GitHub 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
@@ -617,15 +635,15 @@
Do not contact contributors directly about support or help with technical issues.