Metadata-Version: 2.4
Name: django-xrechnung
Version: 0.3.0
Summary: A Django app for handling XRechnung (German electronic invoicing standard)
Author-email: Fabian Braun <fsbraun@gmx.de>
Maintainer-email: Fabian Braun <fsbraun@gmx.de>
License: BSD-3-Clause
Project-URL: Homepage, https://codeberg.org/fsbraun/django-xrechnung
Project-URL: Documentation, https://django-xrechnung.readthedocs.io/en/stable/
Project-URL: Repository, https://codeberg.org/fsbraun/django-xrechnung
Project-URL: Issues, https://codeberg.org/fsbraun/django-xrechnung/issues
Project-URL: Changelog, https://codeberg.org/fsbraun/django-xrechnung/src/branch/main/CHANGELOG.md
Keywords: django,xrechnung,invoice,german,electronic,billing
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: Django
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Framework :: Django :: 6.1
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: POSIX
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Office/Business :: Financial :: Accounting
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django<6.2,>=5.2
Requires-Dist: lxml<7,>=5.3
Requires-Dist: weasyprint<71,>=70
Requires-Dist: tomli>=2; python_version < "3.11"
Provides-Extra: cii
Requires-Dist: drafthorse==2025.2.0; extra == "cii"
Requires-Dist: factur-x==6.8; extra == "cii"
Provides-Extra: hybrid
Requires-Dist: drafthorse==2025.2.0; extra == "hybrid"
Requires-Dist: pypdf==6.18.0; extra == "hybrid"
Requires-Dist: factur-x==6.8; extra == "hybrid"
Provides-Extra: inbound
Requires-Dist: drafthorse==2025.2.0; extra == "inbound"
Requires-Dist: pypdf==6.18.0; extra == "inbound"
Requires-Dist: factur-x==6.8; extra == "inbound"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: pytest-django>=4.5.0; extra == "dev"
Requires-Dist: pytest-xdist>=3.6; extra == "dev"
Requires-Dist: pytest-cov>=7.0.0; extra == "dev"
Requires-Dist: coverage[toml]>=7.10.6; extra == "dev"
Requires-Dist: django-filer>=3.0; extra == "dev"
Requires-Dist: pypdf==6.18.0; extra == "dev"
Requires-Dist: factur-x==6.8; extra == "dev"
Requires-Dist: drafthorse==2025.2.0; extra == "dev"
Requires-Dist: ruff>=0.1.0; extra == "dev"
Requires-Dist: bandit>=1.7.0; extra == "dev"
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-django>=4.5.0; extra == "test"
Requires-Dist: pytest-xdist>=3.6; extra == "test"
Requires-Dist: pytest-cov>=7.0.0; extra == "test"
Requires-Dist: coverage[toml]>=7.10.6; extra == "test"
Requires-Dist: django-filer>=3.0; extra == "test"
Requires-Dist: pypdf==6.18.0; extra == "test"
Requires-Dist: factur-x==6.8; extra == "test"
Requires-Dist: drafthorse==2025.2.0; extra == "test"
Provides-Extra: filer
Requires-Dist: django-filer>=3.0; extra == "filer"
Provides-Extra: postgres
Requires-Dist: psycopg[binary]>=3.2; extra == "postgres"
Dynamic: license-file

# django-xrechnung

[![PyPI version](https://badge.fury.io/py/django-xrechnung.svg)](https://pypi.org/project/django-xrechnung/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-xrechnung)](https://pypi.org/project/django-xrechnung/)
[![PyPI - Django Versions from Framework Classifiers](https://img.shields.io/pypi/frameworkversions/django/django-xrechnung)](https://www.djangoproject.com/)
[![PyPI - License](https://img.shields.io/pypi/l/django-xrechnung)](https://codeberg.org/fsbraun/django-xrechnung/src/branch/main/LICENSE)
[![Latest on Django Packages](https://img.shields.io/badge/Django%20Packages-django--xrechnung-8c3c26)](https://djangopackages.org/packages/p/django-xrechnung/)

**Create validated XRechnung XML and printable PDF invoices in Django.**

Bring invoicing into your existing Django project: prepare drafts in admin or
Python, review calculated totals, then finalize and download both documents.
The app runs the official KoSIT validator locally and renders PDFs with WeasyPrint.
XML, PDF, and the validation report are stored together when finalization succeeds.

## What it does

- **Invoices, credit notes, and corrections:** generate XRechnung 3.0.2 documents
  in UBL 2.1 or CII, including credit notes and corrected invoices linked to their originals.
- **Discounts and surcharges:** put any number of allowances and charges on a line,
  with an optional base amount and percentage, carried through to XML and PDF.
- **Flexible VAT:** combine German 7% and 19% VAT, exempt lines, and reverse charge
  with separate tax breakdowns, exemption reasons, and consistent decimal rounding.
- **Printable PDFs:** produce German invoice layouts with customizable templates,
  wrapping descriptions, repeated table headers, and page numbers.
- **Factur-X output:** generate PDF/A-3b invoices with embedded CII using WeasyPrint,
  validated by veraPDF and the pinned XML rules before issuance.
- **Less repeated data entry:** reuse seller, contact, and payment defaults for
  new drafts without changing existing invoices.
- **Controlled issuance:** enforce ownership and Django permissions, validate
  before issuing, and preserve finalized documents against edits through the app.
- **Django integration:** use the supplied admin, review pages, JSON read endpoints,
  document downloads, and Python services in your own workflows.
- **Incoming invoice review:** receive immutable originals through Python, a
  management command, or admin upload;
  deduplicate within owned inboxes, retain validation evidence, and retry failures.
  Validate UBL/CII XRechnung and Factur-X XML, including XML extracted from PDFs
  with the optional `inbound` extra. Review parsed parties, lines and totals,
  reconciliation mismatches, and unsupported fields without changing originals.

Invoice validation and PDF rendering run on your application host. Invoice data
is not uploaded to an external validation service.

## Project status

**Beta, version 0.3.0.** The draft-to-document workflow is implemented,
including credit notes and corrections. Automated tests exercise real KoSIT
acceptance and rejection, PDF output, permissions, calculations, migrations, and
installation from a built wheel.

The current outgoing invoice scope covers German sellers and buyers, EUR, and
email electronic addresses. VAT covers standard rates, exemption, reverse charge,
zero rating, intra-community supply and export. Payment can be a SEPA transfer to a
German IBAN, a SEPA direct debit, or a card. Lines carry discounts and surcharges,
and an invoice can carry prepaid and rounding amounts, an instalment schedule,
order and contract references, a delivery address, and supporting documents. See the
[supported invoice scenarios](https://django-xrechnung.readthedocs.io/en/stable/reference/supported-invoices.html)
for exact limits.

Document-level allowances and charges, additional countries and currencies, and
transmission integrations are not yet supported. Settlement tracking and cumulative
credit limits remain outside the app. PDFs can be separate printable documents or
Factur-X EN 16931 hybrids with embedded CII and mandatory runtime PDF/A-3b checks.

## Get started

```bash
python -m pip install django-xrechnung
```

Optional extras: `[cii]` for CII output, `[hybrid]` for Factur-X PDF/A-3b,
`[inbound]` for receiving documents, `[filer]` to file stored documents in a
django-filer media library. The development version lives on
[Codeberg](https://codeberg.org/fsbraun/django-xrechnung).

Follow the **[first-invoice tutorial](https://django-xrechnung.readthedocs.io/en/stable/tutorials/first-invoice.html)** to install
into a Django project and generate your first XML and PDF. The
[installation guide](https://django-xrechnung.readthedocs.io/en/stable/how-to/install.html) covers Java and WeasyPrint's
system dependencies.

## Documentation

The [documentation](https://django-xrechnung.readthedocs.io/en/stable/) is organized around tutorials, how-to guides,
reference, and explanation:

- [Configure seller defaults](https://django-xrechnung.readthedocs.io/en/stable/how-to/seller-defaults.html),
  [manage permissions](https://django-xrechnung.readthedocs.io/en/stable/how-to/permissions.html), and
  [customize PDFs](https://django-xrechnung.readthedocs.io/en/stable/how-to/customize-pdf.html).
- [Use VAT exemptions and reverse charge](https://django-xrechnung.readthedocs.io/en/stable/how-to/vat-categories.html).
- [Create credit notes and corrected invoices](https://django-xrechnung.readthedocs.io/en/stable/how-to/adjustments.html).
- Look up [configuration](https://django-xrechnung.readthedocs.io/en/stable/reference/configuration.html),
  [Python services](https://django-xrechnung.readthedocs.io/en/stable/reference/python-api.html), and
  [HTTP endpoints](https://django-xrechnung.readthedocs.io/en/stable/reference/http-api.html).
- Understand [finalization](https://django-xrechnung.readthedocs.io/en/stable/explanation/lifecycle.html) and
  [VAT calculations](https://django-xrechnung.readthedocs.io/en/stable/explanation/calculations.html).
- [Choose CII or Factur-X PDF output](https://django-xrechnung.readthedocs.io/en/stable/how-to/output-formats.html).
- [Receive and review documents](https://django-xrechnung.readthedocs.io/en/stable/how-to/receive-documents.html).

For repository development, see [contributing](https://codeberg.org/fsbraun/django-xrechnung/src/branch/main/CONTRIBUTING.md).

See the [runnable example](https://codeberg.org/fsbraun/django-xrechnung/src/branch/main/example/README.md), [changelog](https://codeberg.org/fsbraun/django-xrechnung/src/branch/main/CHANGELOG.md), and
[compatibility and release policy](https://django-xrechnung.readthedocs.io/en/stable/reference/releases.html).

## License

[BSD 3-Clause](https://codeberg.org/fsbraun/django-xrechnung/src/branch/main/LICENSE). KoSIT, WeasyPrint, and system fonts retain their upstream
licenses.
