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

Fix for potential MissingKey error (#8422)

This commit is contained in:
Oliver 2024-11-03 17:42:24 +11:00 committed by GitHub
parent b25b3493d9
commit 504655c92d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -973,7 +973,10 @@ class StockList(DataExportViewMixin, ListCreateDestroyAPIView):
quantity = data['quantity'] = supplier_part.base_quantity(quantity)
# Divide purchase price by pack size, to save correct price per stock item
if data['purchase_price'] and supplier_part.pack_quantity_native:
if (
data.get('purchase_price')
and supplier_part.pack_quantity_native
):
try:
data['purchase_price'] = float(
data['purchase_price']