From 8662e6a10965e8a413568fab221d48f70be03fa7 Mon Sep 17 00:00:00 2001 From: Oliver Date: Mon, 23 Aug 2021 21:39:00 +1000 Subject: [PATCH] Fix a super annoying validation issue - Was throwing opaque "too many values to unpack" error - Simply needed the name of the field. --- InvenTree/InvenTree/serializers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/InvenTree/InvenTree/serializers.py b/InvenTree/InvenTree/serializers.py index b156e39167..e125c234ce 100644 --- a/InvenTree/InvenTree/serializers.py +++ b/InvenTree/InvenTree/serializers.py @@ -49,7 +49,9 @@ class InvenTreeMoneySerializer(MoneyField): if amount is not None: amount = Decimal(amount) except: - raise ValidationError(_("Must be a valid number")) + raise ValidationError({ + self.field_name: _("Must be a valid number") + }) currency = data.get(get_currency_field_name(self.field_name), self.default_currency)