[18.0][IMP][BCKP] base_tier_validation: clearer notify_on_pending chatter body#1291
Open
bosd wants to merge 1 commit into
Open
[18.0][IMP][BCKP] base_tier_validation: clearer notify_on_pending chatter body#1291bosd wants to merge 1 commit into
bosd wants to merge 1 commit into
Conversation
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.
Contributor
|
Hi @LoisRForgeFlow, |
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.
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:self.env.user.nameinside_notify_requested_review_bodyresolves to whichever usertriggered 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.
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
review.requested_by(set once atrequest_validationtime, never reassigned) so attribution isconsistent across all tiers.
tier.review.todo_byfield for the assigneelabel -- it already handles every review type (individual /
res.usersfield, group,res.groupsfield) with the sameabbreviation rules as the Reviews table.
Backwards-compatible:
_notify_requested_review_body()still workswith 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 withnotify_on_pendingoff). Only the
test_20_no_sequenceadaptation -- which asserts theassignee and the original requester are present in the body -- has been
ported here.
Test plan
test_20_no_sequenceupdated to assert both the assignee(
review_1.todo_by) and the original requester(
review_1.requested_by) are present in the chatter body.