Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

print-format

БесплатноБез исполняемых скриптовНе проверен

Frappe Print Format design — Jinja templates for receipts, certificates, invoices; PDF generation; page handling; multi-currency; wkhtmltopdf rendering. Use…

UnityAppSuiteот UnityAppSuite★ 24 звезды на GitHub

Об этом скилле

Frappe Print Format Reference

Reference for designing Print Formats in Frappe v14+, aligned with the team's edu_quality conventions: self-contained formats (no letter_head / footer injection), wkhtmltopdf pinned as the PDF engine, dd-MM-yyyy date format, and Rs. instead of ₹ to dodge font issues.

Team conventions

These are the rules, not suggestions. New formats follow them; reviews flag deviations.

  1. Do NOT use {{ letter_head }} or {{ footer }}. Every print format is self-contained: header (with logo/QR if needed), body, signature block — all inline in the template. The Letter Head DocType is not part of our print pipeline.
  2. Pin pdf_generator: "wkhtmltopdf" in the Print Format JSON. Don't rely on the system default; v15 introduced Chromium and the team has not adopted it.
  3. Date format: formatdate(doc.field, "dd-MM-yyyy") everywhere. No raw date rendering.
  4. Currency: fmt_money(amt, currency="INR") | replace("₹", "Rs.") or hardcode Rs. directly. The wkhtml fonts we ship don't reliably render ₹; the team standard is Rs..
  5. Margins 15.0 all around, page_number: "Hide", standard: "Yes", print_format_type: "Jinja".
  6. module set to the module name. Files live at {app}/{module}/print_format/{slug}/{slug}.json.

When to use which type

Frappe supports four ways to define a print format:

Type Where it lives When to use
Standard Auto-generated from DocType fields Quick default for new DocTypes; never edit
Custom (Print Format Builder) DB row with format_data JSON Non-developers customizing layout via the UI; commit the JSON via fixtures
Jinja (file-based) DB row with raw html, exported as JSON Developers; full control; goes through git
Server-side Controller method get_print_html Programmatic generation; e.g. dynamic per-customer layouts

For anything code-reviewed and version-controlled, use Jinja (custom_format: 1 with hand-written html). The Print Format Builder (custom_format: 0 with format_data) is fine for layout-only formats but its JSON isn't readable in diffs.

File layout

my_app/
└── my_module/
    └── print_format/
        └── fee_receipt/
            ├── __init__.py
            └── fee_receipt.json     # Print Format DocType row, exported via bench export-fixtures

The HTML lives inside the JSON in the html field. We don't ship separate .html files — keep everything in one fixture row so it round-trips through bench export-fixtures.

Register in hooks.py:

fixtures = [
    {"dt": "Print Format", "filters": "module", "=", "Edu Quality"}
]

Manifest field reference

A typical hand-written Jinja format JSON:

{
    "doctype": "Print Format",
    "name": "Fee Receipt",
    "doc_type": "Payment Entry",
    "module": "Fees",
    "print_format_type": "Jinja",
    "custom_format": 1,
    "standard": "Yes",
    "pdf_generator": "wkhtmltopdf",
    "default_print_language": "en",
    "page_number": "Hide",
    "font_size": 14,
    "margin_top": 15.0,
    "margin_bottom": 15.0,
    "margin_left": 15.0,
    "margin_right": 15.0,
    "html": "<style>...</style><table>...</table>"
}
Field Convention
doc_type The DocType this prints
module Sentence Case module name (e.g. "Fees", "Edu Quality") — must match an installed module
print_format_type "Jinja" always
custom_format 1 for hand-written html; 0 if using format_data (Builder)
standard "Yes" for shipped formats
pdf_generator "wkhtmltopdf" pinned
font_size 14 is the team default; 16 for receipts
margin_* 15.0 all four sides
page_number "Hide"

Jinja context

Inside the template, these variables are available:

Variable What it is
doc The full document being printed (with all child tables)
frappe The full frappe namespace — frappe.utils.*, frappe.db.*
_ Translation function — _("Total")
print_settings The Print Settings Single doc
lang Language code ("en", "hi", ...)

Note letter_head and footer are populated by Frappe but the team convention is don't reference them — every format is self-contained.

Inline DB lookups

Templates pulling from related DocTypes use frappe.db.get_value directly in Jinja. This is the team idiom for receipts that need data the Payment Entry doesn't carry:

{% set reference_number = frappe.db.get_value('Student', doc.party, 'reference_number') %}
{% set program = frappe.db.get_value(doc.reference_doctype, doc.reference_name, 'program') %}
{% set class = frappe.db.get_value('Program', program, 'program_name') %}

<p><b>Receipt No:</b> {{ doc.name }}</p>
<p><b>Reference:</b> {{ reference_number }}</p>
<p><b>Class:</b> {{ class }}</p>

Each `frappe.db.ge

Полный SKILL.md на GitHub

Установить print-format в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл print-format?

Frappe Print Format design — Jinja templates for receipts, certificates, invoices; PDF generation; page handling; multi-currency; wkhtmltopdf rendering. Use when designing or modifying a Print Format, troubleshooting PDF rendering, or formatting documents for print. Follows the team convention of self-contained formats — no `letter_head`/`footer` injection.

Как установить скилл print-format?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл print-format запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить print-format с