Skip to content
/ pyisaf Public

Python library for i.SAF VAT report generation.

License

Notifications You must be signed in to change notification settings

versada/pyisaf

Repository files navigation

pyisaf

image

image

image

Python library for i.SAF VAT report generation.

Features

  • i.SAF data validation based on XSD
  • i.SAF XML builder

Usage

A complete example of i.SAF data dict can be found in the tests.

from pyisaf import schema_v1_2 as isaf_schema, ISAF1_2Builder as Builder
from schema import SchemaError


# Prepare i.SAF data
data = {
    'header': {
        'file_description': {
            # ...
        },
    },
    'master_files': {
        'customers': {
            # ...
        },
        'suppliers': {
            # ...
        },
    },
    'source_documents': {
        'purchase_invoices': {
            # ...
        },
        'sales_invoices': {
            # ...
        },
        'settlements_and_payments': {
            # ...
        },
    },
}
# Validate data against i.SAF schema
isaf_data = isaf_schema.validate(data)

# Build the XML
builder = Builder(isaf_data)
isaf_xml = builder.dumps()