From 67579b5c262e8b6f331981e3adf2c899a5fe4e65 Mon Sep 17 00:00:00 2001 From: Neda Moeini <neda.moeini@geant.org> Date: Mon, 10 Feb 2025 13:22:23 +0100 Subject: [PATCH] Update forms.py based on the models update. --- sage_validation/file_validator/forms.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sage_validation/file_validator/forms.py b/sage_validation/file_validator/forms.py index e3f9850..6413434 100644 --- a/sage_validation/file_validator/forms.py +++ b/sage_validation/file_validator/forms.py @@ -7,7 +7,7 @@ from typing import ClassVar from django import forms from django.core.files.uploadedfile import UploadedFile -from sage_validation.file_validator.models import Meocostcentres, Meovalidsageaccounts, PlAccountCodes, XxData +from sage_validation.file_validator.models import MeoCostCentres, MeoValidSageAccounts, XxData, MeoValidSuppliers class CSVUploadForm(forms.Form): @@ -151,8 +151,8 @@ class CSVUploadForm(forms.Form): errors = [] account_code_map = { - obj.pl_account_code: obj.pl_account_name - for obj in PlAccountCodes.objects.using("meo").all() # type: ignore[attr-defined] + obj.supplier_account_number: obj.supplier_account_name + for obj in MeoValidSuppliers.objects.using("meo").all() # type: ignore[attr-defined] } for index, row in enumerate(data, start=1): @@ -188,7 +188,7 @@ class CSVUploadForm(forms.Form): errors = [] cost_centre_map = { - obj.cc: obj.cctype for obj in Meocostcentres.objects.using("meo").all() + obj.cc: obj.cc_type for obj in MeoCostCentres.objects.using("meo").all() } xx_data_map = { @@ -216,8 +216,8 @@ class CSVUploadForm(forms.Form): nc = xx_data[0] if cc_type == "Project" else xx_data[1] - if not Meovalidsageaccounts.objects.using("meo").filter( - accountcostcentre=cc, accountdepartment=dep, accountnumber=nc + if not MeoValidSageAccounts.objects.using("meo").filter( + account_cost_centre=cc, account_department=dep, account_number=nc ).exists(): errors.append( f"Row {index}: The combination of 'NominalAnalysisNominalCostCentre/1' ({cc}), " -- GitLab