diff --git a/sage_validation/file_validator/forms.py b/sage_validation/file_validator/forms.py index e3f9850e13b5a1799ed1d344ad354363044152f1..641343486905b67a05afef718e921a95b03571b6 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}), "