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
| 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 | minLen: 1 |
| is_default | bool | If True, this is the default format for the DocType | - | |
| css | str | None | Optional custom CSS for styling | |
| header_html | str | None | Optional custom header HTML | |
| footer_html | str | 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
| Role | Create | Delete | Read | Write |
|---|---|---|---|---|
| All | ✓ | |||
| System Manager | ✓ | ✓ | ✓ |
Configuration
| Setting | Value |
|---|---|
| Submittable | False |
| Track Changes | True |
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