From a050ed14e3ba2e4ca0ab832ee1cec0e8b4ce9606 Mon Sep 17 00:00:00 2001 From: koalasat Date: Wed, 25 Sep 2024 13:46:55 +0200 Subject: [PATCH] Avoid duplicated notifications --- api/models/order.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/models/order.py b/api/models/order.py index abd34a2e3..92e59998d 100644 --- a/api/models/order.py +++ b/api/models/order.py @@ -350,7 +350,8 @@ def update_status(self, new_status): self.log( f"Order state went from {old_status}: {Order.Status(old_status).label} to {new_status}: {Order.Status(new_status).label}" ) - send_status_notification.delay(order_id=self.id, status=self.status) + if old_status != new_status: + send_status_notification.delay(order_id=self.id, status=self.status) @receiver(pre_delete, sender=Order)