fix --> batch identity bug in create distribution from ditribute

This commit is contained in:
2026-02-02 12:09:31 +03:30
parent 0dd145131f
commit c5b87e8591

View File

@@ -186,7 +186,9 @@ class TagDistributionService:
parent_tag_distribution = TagDistribution.objects.get(
id=dist_data['parent_tag_distribution']
)
batch = TagBatch.objects.get(batch_identity=dist_data.get('batch_identity'))
batch = TagBatch.objects.get(
batch_identity=dist_data.get('batch_identity')
) if dist_data.get('batch_identity') else None
tags = Tag.objects.filter(
distributions__tag_distribution_batch=parent_batch,
@@ -221,7 +223,7 @@ class TagDistributionService:
assigner_org=org,
assigned_org=assigned_org,
total_tag_count=total_counted_tags,
distribution_type='batch',
distribution_type=parent_batch.distribution_type,
dist_batch_identity=generate_unique_code(
f"{random.randint(1000, 9999)}"
)