Skip to content

Swiss QR-Bill generator for ERPNext Sales Invoices. Automatic generation of compliant QR-Bills with SCOR references, QR-IBAN support, and Swiss Cross embedded QR codes. Multi-language (DE/FR/IT/EN), print-ready payment slips. Compliant with Swiss Payment Standards 2.3.

License

Notifications You must be signed in to change notification settings

Solede-SA/solede_qrbill

Repository files navigation

Solede QR-Bill

License: AGPL v3 Frappe ERPNext

Swiss QR-Bill generator for ERPNext Sales Invoices. Automatically generates compliant QR-Bills for Swiss companies and customers according to Swiss Payment Standards 2.3.

πŸ’‘ Caratteristiche

  • βœ… Complete Swiss QR-Bill generation for Sales Invoices
  • βœ… Automatic QR reference generation with SCOR algorithm
  • βœ… QR-IBAN and standard IBAN support
  • βœ… Structured and unstructured message handling
  • βœ… Swiss Cross embedding in QR code
  • βœ… Print-ready payment slip format (A4 and perforated)
  • βœ… Multi-language support (DE, FR, IT, EN)
  • βœ… IBAN and QR-IBAN validation
  • βœ… Multi-currency support (CHF, EUR)
  • βœ… Zero external dependencies

πŸ“¦ Installazione

# Ottieni l'app da GitHub
bench get-app https://github.com/Solede-SA/solede_qrbill.git

# Installa nel sito
bench --site [nome-sito] install-app solede_qrbill

# Applica modifiche
bench --site [nome-sito] migrate

Requisiti: Frappe v15+, ERPNext v15+, Python 3.10+

πŸ”§ Configurazione

1. Setup Company

Vai in Company β†’ Seleziona la tua azienda e compila:

  • IBAN: IBAN aziendale per ricevere pagamenti
  • QR-IBAN: QR-IBAN specifico (se disponibile)
  • BC Number: Bank Clearing number (numero di clearing bancario)

2. Configura Sales Invoice

I campi QR-Bill sono disponibili automaticamente in Sales Invoice:

  • QR IBAN: IBAN per questo specifico pagamento
  • Creditor Reference: Riferimento strutturato (opzionale, auto-generato)
  • Unstructured Message: Messaggio aggiuntivo per il cliente
  • QR Reference: Auto-generato al submit della fattura

πŸš€ Utilizzo

Generazione Automatica

  1. Crea una Sales Invoice normalmente in ERPNext
  2. Compila i dati standard (Customer, Items, etc.)
  3. Submit la fattura
  4. Il sistema genera automaticamente:
    • QR reference number (formato SCOR)
    • QR code con Swiss Cross
    • Payment slip pronto per la stampa

Print Format

Il QR-Bill viene aggiunto automaticamente al print format della Sales Invoice:

  1. Apri una Sales Invoice submitted
  2. Clicca Print
  3. Seleziona il print format con QR-Bill
  4. Stampa o scarica PDF

Personalizzazione

Puoi personalizzare il QR-Bill modificando:

  • QR-IBAN per fattura specifica
  • Unstructured Message per note al cliente
  • Amount (automatico dal totale fattura)
  • Currency (CHF o EUR)

πŸ“Š Struttura QR-Bill

Il QR-Bill generato include:

Sezione Pagamento

  • Importo: Totale fattura in CHF/EUR
  • Valuta: CHF o EUR
  • Scadenza: Due date della fattura
  • Debitore: Dati cliente (nome, indirizzo)
  • Creditore: Dati azienda (nome, indirizzo, IBAN)

QR Code

  • QR Reference: Numero riferimento SCOR (27 cifre)
  • IBAN/QR-IBAN: Codice bancario
  • Swiss Cross: Logo centrale per autenticitΓ 
  • Formato: Swiss Payment Standards 2.3 compliant

Sezione Ricevuta

  • Informazioni pagamento duplicate
  • Sezione perforabile per distacco
  • Layout conforme standard svizzero

πŸ” Validazione

Il sistema valida automaticamente:

IBAN Validation

  • βœ… Formato IBAN svizzero (CH)
  • βœ… Check digit verification
  • βœ… Lunghezza corretta (21 caratteri)
  • βœ… QR-IBAN specific validation (30000-31999)

Reference Validation

  • βœ… SCOR algorithm check digit
  • βœ… Formato ISO 11649
  • βœ… Lunghezza reference (max 27 caratteri)

Amount Validation

  • βœ… Currency support (CHF, EUR)
  • βœ… Amount formatting svizzero
  • βœ… Max 2 decimal places

Address Validation

  • βœ… Swiss address format
  • βœ… Postal code format (4 digits)
  • βœ… Required fields completeness

πŸ› οΈ Architettura

solede_qrbill/
β”œβ”€β”€ solede_qrbill/
β”‚   β”œβ”€β”€ qrbill/
β”‚   β”‚   β”œβ”€β”€ generator.py      # QR code e reference generation
β”‚   β”‚   β”œβ”€β”€ validator.py      # IBAN e reference validation
β”‚   β”‚   β”œβ”€β”€ utils.py          # Helper functions
β”‚   β”‚   └── overrides.py      # Sales Invoice hooks
β”‚   β”‚
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   β”œβ”€β”€ css/
β”‚   β”‚   β”‚   └── qr_bill_print.css  # Print format styling
β”‚   β”‚   └── js/
β”‚   β”‚       └── sales_invoice.js   # UI enhancements
β”‚   β”‚
β”‚   └── templates/            # Jinja templates for QR-Bill
β”‚
└── README.md

πŸ“ Custom Fields

Sales Invoice

  • custom_qr_iban: QR-IBAN per questo pagamento
  • custom_creditor_reference: Riferimento strutturato SCOR
  • custom_unstructured_message: Messaggio cliente
  • custom_qr_reference: QR reference auto-generato (read-only)

Company

  • custom_bc_number: Bank Clearing number
  • custom_company_iban: IBAN aziendale

Customer

  • custom_customer_iban: IBAN cliente (se applicabile)

πŸ› Troubleshooting

Errori Comuni

"QR-IBAN format not valid"

  • Verifica che il QR-IBAN inizi con "CH" e abbia 21 caratteri
  • Il BC number deve essere tra 30000-31999 per QR-IBAN
  • Usa validator online: https://www.iban.com/

"QR reference not generated"

  • Verifica che la fattura sia in stato "Submitted"
  • Controlla che invoice_number sia compilato
  • Verifica log: logs/[sito]/error.log

"QR code non stampato"

  • Verifica che custom CSS sia caricato
  • Controlla print format settings
  • Prova a rigenerare il print

Debug Mode

# Abilita developer mode
bench --site [sito] set-config developer_mode 1
bench --site [sito] clear-cache
bench restart

# Test generazione QR reference
bench --site [sito] console
>>> from solede_qrbill.qrbill.generator import generate_qr_reference
>>> generate_qr_reference("INV-2025-0001")

🀝 Contribuire

Contribuzioni benvenute! Leggi CONTRIBUTING.md per:

  • Setup ambiente di sviluppo
  • Convenzioni di codice (PEP 8, type hints)
  • Testing guidelines
  • Commit conventions
  • Riferimenti Swiss Payment Standards

Quick Start

# Fork e clone
git clone https://github.com/[your-username]/solede_qrbill.git
cd solede_qrbill

# Setup pre-commit
pre-commit install

# Crea branch
git checkout -b feature/AmazingFeature

# Commit e PR
git commit -m "feat(qr-generator): description"
git push origin feature/AmazingFeature

πŸ“š Risorse

πŸ“„ License

GNU Affero General Public License v3.0 - vedi LICENSE

Copyright (C) 2024-2025 Solede SA and contributors

Puoi usare, modificare e distribuire liberamente. Se offri come servizio web/SaaS, DEVI condividere il codice sorgente modificato.


Sviluppato da Solede SA | GitHub Issues | info@solede.com

About

Swiss QR-Bill generator for ERPNext Sales Invoices. Automatic generation of compliant QR-Bills with SCOR references, QR-IBAN support, and Swiss Cross embedded QR codes. Multi-language (DE/FR/IT/EN), print-ready payment slips. Compliant with Swiss Payment Standards 2.3.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •