commit 1. excel上传问题

This commit is contained in:
彭森 2024-06-15 18:04:16 +08:00
parent ebc809700b
commit df64273da5
1 changed files with 5 additions and 7 deletions

View File

@ -2506,8 +2506,10 @@ def common_excel_parse_pc(request):
def to_representation(self, instance):
representation = super().to_representation(instance)
if 'record_id' in representation and instance.record_id:
representation['record_id'] = instance.record_id.project_name
if 'project_id' in representation and instance.project_id:
representation['project_id'] = instance.project_id.project_name
if 'project_name' in representation and instance.project_name:
representation['project_name'] = instance.project_name.project_name
return representation
return DynamicSerializer
@ -2605,11 +2607,7 @@ def save_excel_table_data_pc(request):
if project_name:
try:
project_instance = ProjectLedger.objects.get(project_name=project_name)
invoice_instance = InvoiceRecord.objects.get(project_name=project_name)
row_data['invoice'] = invoice_instance
row_data['project_id'] = project_instance
row_data['project_name'] = project_instance.project_name
row_data['project_name'] = project_instance
except ProjectLedger.DoesNotExist:
return JsonResponse({'error': f'找不到名称为 {project_name} 的项目台账记录。'}, status=400)