From f24496c5a2dd5e0f808b92da2de848b8ab557593 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 7 Sep 2019 22:42:08 +1000 Subject: [PATCH] Enforce at least one base currency to be selected --- InvenTree/common/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/InvenTree/common/models.py b/InvenTree/common/models.py index de3b9bab2c..61bb9ec138 100644 --- a/InvenTree/common/models.py +++ b/InvenTree/common/models.py @@ -69,7 +69,7 @@ class Currency(models.Model): cur.save() # If there are no currencies set as the base currency, set this as base - if not Currency.objects.filter(base=True).exists(): + if not Currency.objects.exclude(pk=self.pk).filter(base=True).exists(): self.base = True # If this is the base currency, ensure value is set to unity