PrintFormat
Print format configuration DocType.
Stores print template configuration for a DocType.
Attributes: name: Display name for the format doctype: Target DocType this format applies to template: Path to Jinja2 template file is_default: If True, this is the default format for the DocType css: Optional custom CSS for styling header_html: Optional custom header HTML footer_html: Optional custom footer HTML page_size: Page size for PDF (A4, Letter, etc.) orientation: Page orientation (portrait, landscape)
Example: format = PrintFormat( name="Invoice Pro Forma", doctype="Invoice", template="invoice_proforma.html", )Source: print_format.py
Fields
Section titled “Fields”| Field | Type | Required | Description | Validators |
|---|---|---|---|---|
| name | str | ✓ | Display name for the print format | minLen: 1, maxLen: 255 |
| doctype | str | ✓ | Target DocType this format applies to | minLen: 1 |
| template | str | Path to Jinja2 template file (if using file-based templates) | - | |
| custom_html | None | Raw Jinja2/HTML template string (if using DB-based templates) | - | |
| is_default | bool | If True, this is the default format for the DocType | - | |
| css | None | Optional custom CSS for styling | - | |
| header_html | None | Optional custom header HTML | - | |
| footer_html | None | Optional custom footer HTML | - | |
| page_size | str | Page size for PDF (A4, Letter, Legal) | pattern: `^(A4 | |
| orientation | str | Page orientation (portrait, landscape) | pattern: `^(portrait |
Permissions
Section titled “Permissions”| Role | Create | Delete | Read | Write |
|---|---|---|---|---|
| All | ✓ | |||
| System Manager | ✓ | ✓ | ✓ |
Configuration
Section titled “Configuration”| Setting | Value |
|---|---|
| Submittable | False |
| Track Changes | True |
Controller
Section titled “Controller”Controller hooks are implemented in *_controller.py files.
Available lifecycle hooks:
validate()- Called before save, raise exceptions for validation errorsbefore_insert()- Called before inserting a new documentafter_insert()- Called after successfully insertingbefore_save()- Called before saving (insert or update)after_save()- Called after savingbefore_delete()- Called before deletingafter_delete()- Called after deleting