REFACTOR: refactor update review request detail
This commit is contained in:
parent
42176a01c4
commit
aefebbb984
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user