From 4be29346da6a56da45f5ec6f59922f776e90dc18 Mon Sep 17 00:00:00 2001 From: bosd Date: Sun, 22 Oct 2023 23:06:58 +0200 Subject: [PATCH] [IMP]base_tier_validation: only post notifications to reciepients --- base_tier_validation/models/tier_validation.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/base_tier_validation/models/tier_validation.py b/base_tier_validation/models/tier_validation.py index 68e8d49d2f..186d97022e 100644 --- a/base_tier_validation/models/tier_validation.py +++ b/base_tier_validation/models/tier_validation.py @@ -413,13 +413,14 @@ def _notify_review_requested(self, tier_reviews): lambda r: r.definition_id.notify_on_create and r.res_id == rec.id ).mapped("reviewer_ids") # Subscribe reviewers and notify - getattr(rec, subscribe)( - partner_ids=users_to_notify.mapped("partner_id").ids - ) - getattr(rec, post)( - subtype_xmlid=self._get_requested_notification_subtype(), - body=rec._notify_requested_review_body(), - ) + if len(users_to_notify) > 0: + getattr(rec, subscribe)( + partner_ids=users_to_notify.mapped("partner_id").ids + ) + getattr(rec, post)( + subtype_xmlid=self._get_requested_notification_subtype(), + body=rec._notify_requested_review_body(), + ) def request_validation(self): td_obj = self.env["tier.definition"]