From aefebbb984bb8abecfc0a823dee6e6575b144caa Mon Sep 17 00:00:00 2001 From: daovietanh99 Date: Thu, 22 Feb 2024 08:43:09 +0700 Subject: [PATCH] REFACTOR: refactor update review request detail --- cope2n-api/fwd_api/api/accuracy_view.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cope2n-api/fwd_api/api/accuracy_view.py b/cope2n-api/fwd_api/api/accuracy_view.py index 8ce1aff..8f7c798 100644 --- a/cope2n-api/fwd_api/api/accuracy_view.py +++ b/cope2n-api/fwd_api/api/accuracy_view.py @@ -678,6 +678,9 @@ class RequestViewSet(viewsets.ViewSet): subscription_request_files = SubscriptionRequestFile.objects.filter(request=subscription_request.id) reviewed_result = json.loads(data["reviewed_result"]) + for field in ['retailername', 'sold_to_party', 'purchase_date', 'imei_number']: + if not field in reviewed_result.keys(): + raise RequiredFieldException(excArgs=f'reviewed_result.{field}') for subscription_request_file in subscription_request_files: if subscription_request_file.doc_type == 'invoice': @@ -687,9 +690,6 @@ class RequestViewSet(viewsets.ViewSet): subscription_request_file.reviewed_result = {"retailername": None, "sold_to_party": None, "purchase_date": [], "imei_number": [reviewed_result["imei_number"][subscription_request_file.index_in_request]]} subscription_request_file.save() - for field in ['retailername', 'sold_to_party', 'purchase_date', 'imei_number']: - if not field in reviewed_result.keys(): - raise RequiredFieldException(excArgs=f'reviewed_result.{field}') subscription_request.reviewed_result = reviewed_result subscription_request.reviewed_result['request_id'] = request_id subscription_request.is_reviewed = True