Skip to main content

Document Model

Every document in penquify consists of three parts:

DocHeader

The header contains all metadata fields for a logistics document. Every field beyond doc_type, doc_number, and date is optional (defaults to empty string).

DocItem

Each line item in the document.

Computed Properties

The Document class computes totals automatically:

JSON Schema

A complete document as JSON:

Template System

Documents are rendered to HTML using Jinja2 templates. The default template is guia_despacho.html (Chilean dispatch guide). Templates receive the full document dict via doc.to_dict():
  • header.* — all header fields
  • items[] — array of item dicts
  • observations — observation text
  • subtotal, iva, total — computed values
Templates are standard HTML+CSS files stored in penquify/templates/. See the Custom Template guide to create your own.