fix bug of rancher nations code key in transaction

This commit is contained in:
2025-09-29 16:23:22 +03:30
parent c046c60f4a
commit bf1f75fba9
12 changed files with 62 additions and 2 deletions

View File

@@ -122,7 +122,10 @@ class InventoryQuotaSaleTransactionSerializer(serializers.ModelSerializer):
def create(self, validated_data):
items_data = self.context['request'].data['items']
rancher_code = validated_data.pop('rancher_national_code')
rancher_code = validated_data.pop(
'rancher_national_code'
) if 'rancher_national_code' in self.context['request'].data.keys() else None
with atomic():
# get rancher with national code
rancher = None