Skip to content

Generate EPC (SEPA Credit Transfer) QR codes inside Frappe/ERPNext

License

Notifications You must be signed in to change notification settings

david-loe/epc_qrcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EPC QR Code

Generate EPC (SEPA Credit Transfer) QR codes inside Frappe/ERPNext, especially for invoices and other print formats.

Requirements

  • Frappe >=15,<17
  • Python >=3.10
  • App dependency: segno~=1.6.1 (installed automatically with the app)

Install On Frappe Bench

Run these commands from your bench directory:

bench get-app https://github.com/david-loe/epc_qrcode.git
bench --site <your-site> install-app epc_qrcode

What This App Exposes

The app adds one whitelisted and Jinja-available method:

epc_qrcode.gen.gen_epcqrcode

Signature:

gen_epcqrcode(
    name,
    iban,
    amount,
    text=None,
    reference=None,
    bic=None,
    purpose=None,
    encoding=None,
    scale=3,
    dark="#000",
    light="#fff",
)

Return value:

PNG Data URI string (for example: data:image/png;base64,...)

Use gen_epcqrcode In Print Formats

Because the method is registered in hooks as a Jinja method, you can call it directly in HTML/Jinja print formats.

Minimal Example

{% set qr = gen_epcqrcode(
    name="ACME GmbH",
    iban="DE89370400440532013000",
    amount=doc.rounded_total or doc.grand_total,
    text=("Invoice " ~ doc.name)
) %}

<img src="{{ qr }}" alt="EPC QR" style="width: 140px; height: 140px;" />

Parameter Notes

  • name: Beneficiary name (receiver)
  • iban: Beneficiary IBAN
  • amount: Transfer amount (number)
  • text: Unstructured remittance information (optional)
  • reference: Structured creditor reference (optional)
  • bic: Receiver BIC (optional, but recommended for compatibility)
  • purpose: ISO purpose code (optional)
  • encoding: EPC text encoding (optional)
  • scale: QR image size multiplier (default 3)
  • dark, light: QR colors (defaults #000 / #fff)

Troubleshooting

  • jinja2.exceptions.UndefinedError: 'gen_epcqrcode' is undefined
    • Confirm app installation: bench --site <your-site> list-apps
    • Restart bench: bench restart
  • Broken QR image in print
    • Ensure the template uses <img src="{{ qr }}"> (not {{ qr }} directly)
    • Validate IBAN and amount values passed from doc

License

MIT

About

Generate EPC (SEPA Credit Transfer) QR codes inside Frappe/ERPNext

Topics

Resources

License

Stars

Watchers

Forks

Languages