CORD-3128 Only set the owner of a ServiceInstance if it is not deleted
Change-Id: I76b124baa6f124cc124c78b7cc488b73d3862cc6
diff --git a/xos/core/models/serviceinstance.py b/xos/core/models/serviceinstance.py
index 06919d6..577b3d9 100644
--- a/xos/core/models/serviceinstance.py
+++ b/xos/core/models/serviceinstance.py
@@ -71,7 +71,9 @@
self.owner = Service.objects.get(id = self._meta.get_field("owner").default)
def save(self, *args, **kwargs):
- self.set_owner()
+ # NOTE(CORD-3128): Only set the owner if not in deleted state.
+ if not self.deleted:
+ self.set_owner()
# If the model has a Creator and it's not specified, then attempt to default to the Caller. Caller is
# automatically filled in my the API layer. This code was typically used by ServiceInstances that lead to