Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion base_tier_validation/models/tier_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -853,7 +853,18 @@ def restart_validation(self):
def _update_counter(self, review_counter):
self.review_ids._update_review_status()
channel = "base.tier.validation/updated"
self.env.user.partner_id._bus_send(channel, review_counter)
# Notify the reviewers whose pending count actually changes, not the
# acting user. Sending the delta to ``self.env.user`` made unrelated
# users' systray counters drift (even negative) whenever someone acted
# on a tier-validated record without being one of its reviewers. When
# the reviews are already gone (deletions), fall back to the acting
# user. The client recomputes the absolute count on receipt, so the
# exact audience only affects how promptly a reviewer sees the update.
partners = self.review_ids.mapped("reviewer_ids.partner_id")
if not partners:
partners = self.env.user.partner_id
for partner in partners:
partner._bus_send(channel, review_counter)

def unlink(self):
self.mapped("review_ids").unlink()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@ export class TierReviewMenu extends Component {
this.orm = useService("orm");
this.store = useState(useService("mail.store"));
this.action = useService("action");
this.busService = useService("bus_service");
this.dropdown = useDropdownState();
this.fetchSystrayReviewer();
// Keep the badge live and correct: re-fetch the authoritative count
// whenever a tier review changes server-side, instead of nudging a
// running +/- delta. The absolute value is a len() and so can never go
// negative, which a delta could when an update reaches a user for whom
// the review was never part of their pending count.
this.busService.subscribe("base.tier.validation/updated", () =>
this.fetchSystrayReviewer()
);
this.busService.start();
}

async fetchSystrayReviewer() {
Expand Down

This file was deleted.

Loading