Handle case where notes are not provided

This commit is contained in:
Oliver 2021-10-05 22:46:34 +11:00
parent 102f886d81
commit 0a2a81582e

View File

@ -475,7 +475,7 @@ class StockCountSerializer(StockAdjustmentSerializer):
data = self.validated_data data = self.validated_data
items = data['items'] items = data['items']
notes = data['notes'] notes = data.get('notes', '')
with transaction.atomic(): with transaction.atomic():
for item in items: for item in items:
@ -500,7 +500,7 @@ class StockAddSerializer(StockAdjustmentSerializer):
request = self.context['request'] request = self.context['request']
data = self.validated_data data = self.validated_data
notes = data['notes'] notes = data.get('notes', '')
with transaction.atomic(): with transaction.atomic():
for item in data['items']: for item in data['items']:
@ -525,7 +525,7 @@ class StockRemoveSerializer(StockAdjustmentSerializer):
request = self.context['request'] request = self.context['request']
data = self.validated_data data = self.validated_data
notes = data['notes'] notes = data.get('notes', '')
with transaction.atomic(): with transaction.atomic():
for item in data['items']: for item in data['items']:
@ -575,7 +575,7 @@ class StockTransferSerializer(StockAdjustmentSerializer):
data = self.validated_data data = self.validated_data
items = data['items'] items = data['items']
notes = data['notes'] notes = data.get('notes', '')
location = data['location'] location = data['location']
with transaction.atomic(): with transaction.atomic():