diff --git a/docs/source/conf.py b/docs/source/conf.py index 5cb62b06f7730cd2c493e068b4f21a68c1df7e37..a7b6713421f7efa09f1f68d2410e65358c187054 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -12,8 +12,12 @@ # import os import sys -sys.path.insert(0, os.path.abspath('../sage-validation')) +import django +sys.path.insert(0, os.path.abspath("../../")) +sys.path.insert(0, os.path.abspath("../../sage_validation/")) +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sage_validation.settings") +django.setup() # -- Project information ----------------------------------------------------- diff --git a/docs/source/file_validator/forms.rst b/docs/source/file_validator/forms.rst new file mode 100644 index 0000000000000000000000000000000000000000..9ec6c70c73ae8355166e63d7b6791edc13286e33 --- /dev/null +++ b/docs/source/file_validator/forms.rst @@ -0,0 +1,8 @@ +========================================== +Sage Validation - File Validator Forms +========================================== + +.. automodule:: file_validator.forms + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/file_validator/index.rst b/docs/source/file_validator/index.rst new file mode 100644 index 0000000000000000000000000000000000000000..c984a6a902405bf8cff995ccf3b746e6343b6b6f --- /dev/null +++ b/docs/source/file_validator/index.rst @@ -0,0 +1,10 @@ +========================================== +File Validator Module +========================================== + +.. toctree:: + :maxdepth: 2 + :caption: Components: + + views + forms \ No newline at end of file diff --git a/docs/source/file_validator/views.rst b/docs/source/file_validator/views.rst new file mode 100644 index 0000000000000000000000000000000000000000..548bc76fcdcd0bb13c44656cd3f04cd159d05a15 --- /dev/null +++ b/docs/source/file_validator/views.rst @@ -0,0 +1,8 @@ +========================================== +Sage Validation - File Validator Views +========================================== + +.. automodule:: file_validator.views + :members: + :undoc-members: + :show-inheritance: \ No newline at end of file diff --git a/docs/source/index.rst b/docs/source/index.rst index 2af1b6c9e73ac03dce2472f8a752e770c08ea653..cc6b07511f194a369b4d07040e826bdd261b1deb 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -10,11 +10,7 @@ Welcome to Sage Validation's documentation! :maxdepth: 2 :caption: Contents: - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` + validations + file_validator/index + file_validator/views + file_validator/forms \ No newline at end of file diff --git a/docs/source/validations.rst b/docs/source/validations.rst new file mode 100644 index 0000000000000000000000000000000000000000..13bcc924a0d12787957fcbf346e91af60c155f65 --- /dev/null +++ b/docs/source/validations.rst @@ -0,0 +1,63 @@ +==================================== +CSV Upload Validation Rules +==================================== + +The following table describes the validation rules applied when uploading a CSV file. + +.. list-table:: + :header-rows: 1 + :widths: 20 20 40 20 + + * - **Type** + - **Field** + - **Logic** + - **Comments** + + * - Structural + - *(All Fields)* + - Ensure that all required field names are present. + - - + * - Update + - `...NominalAccountNumber` (*n) + - If value starts with `xx-`, map `NominalCostCentre` using `dbo.meoCostCentres` and retrieve `NominalAccountNumber` from `dbo.vw_xx-data`. + - Ensure the correct nominal code is assigned. + + * - Checks + - AccountNumber + - Validate against `dbo.meoValidSuppliers`. + - Ensure the account exists in the valid suppliers list. + + * - Checks + - Source + - Should always be `80`. + - Reject rows where `Source != 80`. + + * - Checks + - SYSTraderTranType + - Should always be `4`. + - Reject rows where `SYSTraderTranType != 4`. + + * - Update + - TransactionDate + - Set to today’s date (`dd/mm/yyyy`). + - Ensure all rows have a consistent transaction date. + + * - Checks + - `...NominalAccountNumber` (*n) + - Validate against `[Nom]` in `dbo.meoNominal`. + - Ensure all nominal account numbers exist. + + * - Checks + - `...NominalCostCentre` (*n) + - Validate against `dbo.meoCostCentres`. + - Ensure cost centres exist. + + * - Checks + - Combination of `...NominalAccountNumber`, `...NominalCostCentre`, and `...NominalDepartment` + - Validate against `dbo.meoValidSageAccounts`. + - The combination of the three fields must be valid. + + * - Checks + - `...TaxRate` + - Validate against `[Tax code]` in `dbo.meoValidVAT`. + - Ensure valid tax rates. \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index a1b9380c20310dd608358bc08ff1c634d5cc92c9..dbfb9a18f0a7d5644f82aaf575bd13a6019185de 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,6 +5,7 @@ mypy tox sphinx sphinx-autodoc-typehints +sphinx-autodoc mssql-django pytest pytest-django