From 127ec31ea7d5edabd9816bd3f60b02505d7397b9 Mon Sep 17 00:00:00 2001 From: bosd Date: Sun, 22 Oct 2023 23:06:58 +0200 Subject: [PATCH] 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 817a5d4aee..2cc33a67d4 100644 --- a/base_tier_validation/models/tier_validation.py +++ b/base_tier_validation/models/tier_validation.py @@ -447,13 +447,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"]