[19.0][FIX] base_tier_validation: recompute can_review when a sibling review changes status#54
Open
bosd wants to merge 1 commit into
Open
[19.0][FIX] base_tier_validation: recompute can_review when a sibling review changes status#54bosd wants to merge 1 commit into
bosd wants to merge 1 commit into
Conversation
…w changes ``tier.review.can_review`` is a *stored* computed field, but its value (``_can_review_value``) reads the *other* reviews of the same record -- it returns True only for the review holding the lowest pending sequence. Its ``@api.depends`` can only list this review's own fields, because the link to the sibling reviews is the generic ``(model, res_id)`` reference, which ``@api.depends`` cannot traverse. As a result, changing one review's status does not recompute the others' ``can_review``. The most visible symptom: once the first tier of an ``approve_sequence`` chain is approved, the next tier's stored ``can_review`` stays False, so the record never appears in that reviewer's systray (``review_user_count`` filters on ``can_review = True``) until something else happens to touch the review's own fields. Recompute the siblings' ``can_review`` explicitly whenever a review's ``status`` is written (scoped per ``(model, res_id)`` via ``env.add_to_compute``). Adds ``test_19d_can_review_recomputes_on_sibling_status_change``.
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.
Problem
tier.review.can_reviewis a stored computed field, but its value (_can_review_value) depends on the other reviews of the same record — it returnsTrueonly for the review holding the lowest pending sequence. Its@api.dependscan only list this review's own fields (status,sequence,approve_sequence,model,res_id), because the link to the siblings is the generic(model, res_id)reference, which@api.dependscan't traverse.So when one review's status changes, the siblings' stored
can_reviewis not recomputed. The visible symptom: once the first tier of anapprove_sequencechain is approved, the next tier's storedcan_reviewstaysFalse, soreview_user_count(which filterscan_review = True) never surfaces the record in that reviewer's systray until something else happens to touch the review's own fields. In practice large backlogs of pending approvals silently disappear from reviewers' systrays.Fix
Recompute the siblings'
can_reviewwhenever a review'sstatusis written — scoped per(model, res_id)viaenv.add_to_compute. This expresses the cross-review dependency that@api.dependscannot.Test
test_19d_can_review_recomputes_on_sibling_status_change: a later-tier review is pending-but-not-lowest (can_reviewcorrectlyFalse); approving the first tier (a sibling status change) must flip the later tier's storedcan_reviewtoTrue. Fails before the fix (staysFalse), passes after.