[19.0][IMP] base_tier_validation: clearer notify_on_pending chatter body#22
Open
bosd wants to merge 1 commit into
Open
[19.0][IMP] base_tier_validation: clearer notify_on_pending chatter body#22bosd wants to merge 1 commit into
bosd wants to merge 1 commit into
Conversation
Contributor
|
Hi @LoisRForgeFlow, |
This was referenced May 12, 2026
The chatter message posted when a tier reaches ``pending`` has two problems: 1. ``self.env.user.name`` is wrong on second-and-later tier promotions. ``_notify_review_available`` runs inside ``_validate_tier -> _update_counter -> _update_review_status``, where ``env.user`` is the *approver* of the previous tier, not the person who originally pressed *Request Validation*. The message therefore credits the wrong user. 2. Chatter system notifications do not render the "Notified to" pill the way user-typed comments do, so a recipient seeing *"A review has been requested by Administrator"* in their inbox cannot tell whether the message was meant for them or for somebody else. Source the requester from ``review.requested_by`` (set once at ``request_validation`` time) and weave the assignee into the body by reusing ``tier.review.todo_by`` -- so the new wording reads, for example, *"Review pending for Mike, requested by Administrator."* ``todo_by`` already handles every review type (individual user, group, ``res.users`` / ``res.groups`` field) and tracks the same abbreviation rules as the Reviews table, keeping the chatter message and the table consistent.
32e083c to
481aa54
Compare
jaydeep32
pushed a commit
to archeti-org/tier-validation
that referenced
this pull request
May 14, 2026
…r the validation. (OCA#22)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The chatter message posted when a tier reaches
pending(from_notify_review_available) has two UX problems users have reported:Wrong attribution on later tiers. The body reads "A review has been requested by Administrator" on tier 1 and then, after tier 1 is approved and tier 2 is auto-promoted, "A review has been requested by Tier-1-Reviewer". The previous reviewer never pressed Request Validation -- they pressed Validate -- so crediting them for requesting the next tier is misleading. Cause:
self.env.user.nameinside_notify_review_availableresolves to whichever user happened to trigger the promotion, not the original requester. On the second tier that's the tier-1 approver.No way to tell who the message is for. Chatter system notifications do not render the "Notified to" pill the way user-typed comments do. A recipient seeing "A review has been requested by Administrator" in their inbox cannot tell whether the message was meant for them or for somebody else.
Fix
tier_reviewsto_notify_requested_review_body; source the requester fromreview.requested_by(set once atrequest_validationtime, never reassigned) so the attribution is consistent across all tiers.tier.review.todo_byfield for the assignee label. It already handles every review type:res.usersfield: name(s), abbreviated past 3 with "(and N more)".res.groupsfield: same logic viauser_ids.Backwards-compatible:
_notify_requested_review_body()still works with no arguments and returns the previous short body for any downstream overrider that may call it that way (the reminder activity body, custom modules that rendered the requester body themselves, etc).Why not switch to
message_type='comment'to get the pillaccount_followupreminders, etc.) deliberately usemessage_type='notification'and put the recipient context in the body. This PR follows that convention.Why not schedule a
mail.activityper reviewer (per-user TODO)That would land the review in each reviewer's My Activities widget, which is the strongest UX. But it adds:
mail.activitytype (or reuse the existing reminder activity for a different purpose),_validate_tier,_rejected_tierandrestart_validationto avoid stale activities,Out of scope here; happy to follow up with that as a separate PR if there is appetite.
Test plan
test_19a_notify_on_pending_sequence_negativeextended to verify:review_first.todo_by) and the original requester (env.user.display_namefrom whenrequest_validationran),review_second.todo_by) and the original requester -- and does not contain the tier-1 approver's name (regression guard for the attribution bug).test_20_no_sequenceupdated to assert both the assignee and the requester are present in the body.Depends on
PR #21 ([FIX] base_tier_validation: auto-promote first review to pending). Branched off it so the changes compose; can be rebased onto
19.0once that lands.CC @LoisRForgeFlow