fix bug of ranvher nmional code key in transaction

This commit is contained in:
2025-09-28 12:07:32 +03:30
parent e9caad0dbf
commit fe93a22be1
2 changed files with 4 additions and 3 deletions

View File

@@ -123,6 +123,7 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
items_data = self.context['request'].data['items']
with atomic():
# get rancher with national code
if 'rancher_national_code' in validated_data.keys():
rancher = Rancher.objects.get(national_code=validated_data.pop('rancher_national_code'))
validated_data.update({'rancher': rancher})