2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-04-30 04:26:44 +00:00

Fix a super annoying validation issue

- Was throwing opaque "too many values to unpack" error
- Simply needed the name of the field.
This commit is contained in:
Oliver 2021-08-23 21:39:00 +10:00
parent 1fb76b9987
commit 8662e6a109

View File

@ -49,7 +49,9 @@ class InvenTreeMoneySerializer(MoneyField):
if amount is not None: if amount is not None:
amount = Decimal(amount) amount = Decimal(amount)
except: 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) currency = data.get(get_currency_field_name(self.field_name), self.default_currency)