mirror of
https://github.com/inventree/InvenTree.git
synced 2025-12-14 00:09:56 +00:00
Allow null values for InvenTreeDecimalField (#10948)
- Fixes bug related to importing null "rounding_multiple" BOM field
This commit is contained in:
@@ -646,6 +646,11 @@ class InvenTreeDecimalField(serializers.FloatField):
|
||||
|
||||
def to_internal_value(self, data):
|
||||
"""Convert to python type."""
|
||||
if data in [None, '']:
|
||||
if self.allow_null:
|
||||
return None
|
||||
raise serializers.ValidationError(_('This field may not be null.'))
|
||||
|
||||
# Convert the value to a string, and then a decimal
|
||||
try:
|
||||
return Decimal(str(data))
|
||||
|
||||
Reference in New Issue
Block a user