Skip to content

[18.0][IMP][BCKP] base_tier_validation: clearer notify_on_pending chatter body#1291

Open
bosd wants to merge 1 commit into
OCA:18.0from
bosd:18.0-imp-base_tier_validation-notify_on_pending-body
Open

[18.0][IMP][BCKP] base_tier_validation: clearer notify_on_pending chatter body#1291
bosd wants to merge 1 commit into
OCA:18.0from
bosd:18.0-imp-base_tier_validation-notify_on_pending-body

Conversation

@bosd

@bosd bosd commented May 17, 2026

Copy link
Copy Markdown
Contributor

Backport of OCA/tier-validation#22 to 18.0.

Problem

The chatter message posted when a tier reaches pending (from
_notify_review_available) has two UX problems:

  1. Wrong attribution on later tiers. self.env.user.name inside
    _notify_requested_review_body resolves to whichever user
    triggered the promotion. On second-and-later tiers that is the
    approver of the previous tier, not the person who pressed
    Request Validation -- so the message credits the wrong user.
  2. 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"
    cannot tell whether it was meant for
    them.

Fix

  • Source the requester from review.requested_by (set once at
    request_validation time, never reassigned) so attribution is
    consistent across all tiers.
  • Reuse the existing tier.review.todo_by field for the assignee
    label -- it already handles every review type (individual /
    res.users field, group, res.groups field) with the same
    abbreviation rules as the Reviews table.
  • New wording: "Review pending for Mike, requested by Administrator."

Backwards-compatible: _notify_requested_review_body() still works
with no arguments and returns the previous short body for any
downstream overrider that calls it that way.

Notes on backport scope

The upstream PR also extends test_19a_notify_on_pending_sequence_negative,
which was introduced by its dependency OCA/tier-validation#21 and does
not exist on this branch (18.0's nearest equivalent,
test_19_waiting_tier, deliberately runs with notify_on_pending
off). Only the test_20_no_sequence adaptation -- which asserts the
assignee and the original requester are present in the body -- has been
ported here.

Test plan

  • test_20_no_sequence updated to assert both the assignee
    (review_1.todo_by) and the original requester
    (review_1.requested_by) are present in the chatter body.

Backport of OCA/tier-validation#22.

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."*

The method keeps a no-argument fallback returning the previous short
body, so any downstream overrider that calls it without arguments is
unaffected.
@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @LoisRForgeFlow,
some modules you are maintaining are being modified, check this out!

@OCA-git-bot OCA-git-bot added series:18.0 mod:base_tier_validation Module base_tier_validation labels May 17, 2026
@bosd bosd changed the title [18.0][IMP] base_tier_validation: clearer notify_on_pending chatter body [18.0][IMP][BCKP] base_tier_validation: clearer notify_on_pending chatter body May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:base_tier_validation Module base_tier_validation series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants