update hatching

This commit is contained in:
2026-02-07 15:16:56 +03:30
parent 5dee0d604f
commit 2741c5ee89

View File

@@ -806,7 +806,7 @@ class HatchingsViewSet(viewsets.ModelViewSet):
'MenuUserAccess', 'LogTableName', 'LogTableAlias', 'PageTitle', 'MenuUserAccess', 'LogTableName', 'LogTableAlias', 'PageTitle',
'PartIdCode', 'UnitTypeName' 'PartIdCode', 'UnitTypeName'
] ]
if int(request.data['GoodSum']['loadingSum ']) > 0:
for key in same_keys: for key in same_keys:
if key in request.data and request.data[key] is not None: if key in request.data and request.data[key] is not None:
poultry_data[key] = request.data[key] poultry_data[key] = request.data[key]
@@ -975,8 +975,8 @@ class HatchingsViewSet(viewsets.ModelViewSet):
hatching.samasat_discharge_percentage = int( hatching.samasat_discharge_percentage = int(
((hatching.Evacuation + bars_quantity) / hatching.ChickCountSum) * 100) ((hatching.Evacuation + bars_quantity) / hatching.ChickCountSum) * 100)
hatching.save() hatching.save()
# else: else:
# print('تعداد حمل صفر است') print('تعداد حمل صفر است')
return Response({"result": "با موفقیت ثبت شد"}, status=status.HTTP_201_CREATED) return Response({"result": "با موفقیت ثبت شد"}, status=status.HTTP_201_CREATED)
def list(self, request, *args, **kwargs): def list(self, request, *args, **kwargs):