commit 3049aba8c34142acc509444287b2d9e2378a0d22 Author: Tomas Date: Tue Aug 25 00:46:20 2026 +0200 Initial import from ash-technology/l10n_cz_extra Czech QR Payment (SPAYD) module for Odoo 19 - Generates Czech standard QR codes for invoices - Compatible with all major Czech banking apps Cloned from: https://github.com/ash-technology/l10n_cz_extra Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe diff --git a/README.cs.md b/README.cs.md new file mode 100644 index 0000000..fd5e7f1 --- /dev/null +++ b/README.cs.md @@ -0,0 +1,37 @@ +🇬🇧 [English version](README.md) + +# QR platby v českém prostředí +Modul přidává na faktury QR kód pro rychlou platbu mobilem. Kódy jsou ve formátu SPAYD + +* **Způsob zadání bankovního účtu** Česká bankovní účty zadávejte do standardního pole Odoo v českém formátu, např. `123-456/0800` +![Zadání bankovního účtu](static/description/bank_account.png) + +* **Zahraniční účty:** Pokud se jedná o zahraniční účty, do stejného pole (standardní pole v Odoo) můžete zadat IBAN. +* **Podpora měny:** Český QR kód se generuje pro faktury v měně CZK. Pro zahraniční platby je ponechán původní QR kód Odoo. + +#### Často kladené dotazy (FAQ) +**QR kód se na faktuře negeneruje** +Ujistěte se, že v konfiguraci aplikace **Fakturace** máte zaškrtnutou volbu **QR kódy** +![Nastavení QR kódů](static/description/qr_payment_settings.png) + +**QR kód se na faktuře vygeneruje, ale jeho načtení hlásí chybu** +Zkontrolujte, zda máte na hlavní společnosti zadaný bankovní účet pro českou měnu. Podívejte se na část "Způsob zadání bankovního účtu" výše. + +--- + +## O modulu + +Tento modul je vyvíjen a spravován společností **[Ash technology s.r.o.](https://www.ashtechnology.eu)**, oficiálním partnerem Odoo v České republice. + +Modul je zdarma a open-source. Uvítáme vaši zpětnou vazbu a návrhy na vylepšení – pokud váš nápad pomůže komunitě, rádi ho zapracujeme. + +**Kontakt:** +- Web: [www.ashtechnology.eu](https://www.ashtechnology.eu) +- Email: info@ashtechnology.eu + +Pro zakázkový vývoj v Odoo nebo větší projekty nás neváhejte kontaktovat. + +--- + +*Odoo je ochranná známka společnosti Odoo S.A.* + diff --git a/README.md b/README.md new file mode 100644 index 0000000..c4c47b6 --- /dev/null +++ b/README.md @@ -0,0 +1,38 @@ +🇨🇿 [Česká verze](README.cs.md) + +# Czech QR Payments + +This module adds QR codes to invoices for quick mobile payments. The codes are in SPAYD format, compatible with all major Czech banking apps. + +* **Bank account format:** Enter Czech bank accounts in the standard Odoo field using the Czech format, e.g., `123-456/0800` +![Bank Account Entry](static/description/bank_account_en.png) + +* **Foreign accounts:** For foreign accounts, you can enter IBAN in the same field (standard Odoo field). +* **Currency support:** Czech QR codes are generated for invoices in CZK currency. For foreign payments, the original Odoo QR code is preserved. + +## Frequently Asked Questions (FAQ) + +**The QR code is not generated on the invoice** +Make sure you have the **QR Codes** option enabled in the **Invoicing** app configuration. +![QR Code Settings](static/description/qr_payment_settings_en.png) + + +**The QR code is generated on the invoice, but scanning it results in an error** +Check whether a bank account for the Czech currency is set up for the main company. See "Bank account format" section above. +--- + +## About + +This module is developed and maintained by **[Ash technology s.r.o.](https://www.ashtechnology.eu)**, an official Odoo partner based in the Czech Republic. + +These modules are free and open-source. We welcome your feedback and feature requests – if your idea benefits the community, we're happy to include it. + +**Contact us:** +- Web: [www.ashtechnology.eu](https://www.ashtechnology.eu) +- Email: info@ashtechnology.eu + +For custom Odoo development or larger projects, feel free to reach out. + +--- + +*Odoo is a trademark of Odoo S.A.* diff --git a/__init__.py b/__init__.py new file mode 100644 index 0000000..9a7e03e --- /dev/null +++ b/__init__.py @@ -0,0 +1 @@ +from . import models \ No newline at end of file diff --git a/__manifest__.py b/__manifest__.py new file mode 100644 index 0000000..559f93a --- /dev/null +++ b/__manifest__.py @@ -0,0 +1,33 @@ +{ + 'name': 'Czech QR Payment (SPAYD)', + 'version': '19.0.1.0.0', + 'depends': ['account', 'base', 'l10n_cz'], + 'countries': ['cz'], + 'category': 'Accounting', + 'summary': 'Add Czech standard QR codes for payment to your invoices.', + 'description': """ + +Czech QR Payment Generator +========================== +Allow to generate czech banks compliant QR code for payment on the invoice, if the invoice currency is "CZK" + +Key Features: +------------- +* **Standard SPAYD Support:** Fully compatible with all major Czech banking apps. +* **Smart IBAN Conversion:** Automatically converts local account numbers (e.g. 123-456/0800) to IBAN format. +* **Integration:** Works with standard Odoo invoice templates. + """, + 'author': 'Ash technology s.r.o.', + 'website': 'https://github.com/ash-technology/l10n_cz_extra', + 'license': 'LGPL-3', + 'external_dependencies': { + 'python': ['qrcode'], + }, + 'data': [ + 'views/report_invoice.xml', + ], + 'installable': True, + 'auto_install': False, + 'application': False, + 'images': ['static/description/qr_payment_main_screenshot.png'], +} \ No newline at end of file diff --git a/i18n/cs_CZ.po b/i18n/cs_CZ.po new file mode 100644 index 0000000..8b3bd60 --- /dev/null +++ b/i18n/cs_CZ.po @@ -0,0 +1,20 @@ + +#. module: l10n_cz_extra +#: model:ir.model.fields,field_description:ash_cz_qr_payment.field_account_move__display_name +msgid "Display Name" +msgstr "Zobrazovaný název" + +#. module: ash_cz_qr_payment +#: model:ir.model,name:ash_cz_qr_payment.model_account_move +msgid "Journal Entry" +msgstr "Účetní záznam" + +#. module: ash_cz_qr_payment +#: model_terms:ir.ui.view,arch_db:ash_cz_qr_payment.report_invoice_document_cz +msgid "QR Payment" +msgstr "QR Platba" + +#. module: ash_cz_qr_payment +#: model_terms:ir.ui.view,arch_db:ash_cz_qr_payment.report_invoice_document_cz +msgid "Scan this QR Code with
your banking application" +msgstr "Naskenujte tento QR kód v bankovní aplikaci" diff --git a/models/__init__.py b/models/__init__.py new file mode 100755 index 0000000..4c89822 --- /dev/null +++ b/models/__init__.py @@ -0,0 +1 @@ +from . import account_move \ No newline at end of file diff --git a/models/account_move.py b/models/account_move.py new file mode 100644 index 0000000..ccad094 --- /dev/null +++ b/models/account_move.py @@ -0,0 +1,76 @@ +import qrcode +import base64 +import io +from odoo import models, api + +class AccountMove(models.Model): + _inherit = 'account.move' + + def get_cz_qr_code_base64(self): + """ Returns Base64 PNG image for the invoice PDF """ + self.ensure_one() + if self.currency_id.name != 'CZK': + return False + + # Find bank: 1. Matching CZK, 2. No currency set (default) + bank = self.company_id.partner_id.bank_ids.filtered(lambda b: b.currency_id == self.currency_id)[:1] + if not bank: + bank = self.company_id.partner_id.bank_ids.filtered(lambda b: not b.currency_id)[:1] + + if not bank or not bank.acc_number: + return False + + # Build SPAYD string + iban = self.cz_to_iban(bank.acc_number) + amount = '%.2f' % self.amount_residual + vs = ''.join(filter(str.isdigit, self.payment_reference or ''))[-10:] + + spayd = f"SPD*1.0*ACC:{iban}*AM:{amount}*CC:CZK*X-VS:{vs}" + + # Generate QR Image + qr = qrcode.make(spayd) + buf = io.BytesIO() + qr.save(buf, format="PNG") + return base64.b64encode(buf.getvalue()).decode('utf-8') + + def cz_to_iban(self, acc_number): + """ + Converts '123-456/0800' or '456/0800' to a valid CZ IBAN. + """ + if not acc_number: + return "" + + # Clean the input + clean_acc = acc_number.replace(" ", "") + + # If already an IBAN, return it + if clean_acc.upper().startswith('CZ'): + return clean_acc.upper() + + try: + # Split into [prefix-main, bank_code] + parts = clean_acc.split('/') + if len(parts) != 2: + return clean_acc # Fallback + + bank_code = parts[1] + account_parts = parts[0].split('-') + + if len(account_parts) == 2: + prefix = account_parts[0].zfill(6) + main = account_parts[1].zfill(10) + else: + prefix = "000000" + main = account_parts[0].zfill(10) + + # 1. Start with Bank Code + Prefix + Main + Country Number (CZ=12, 35=Z) + 00 + # Czech Republic code is 123500 (12 for C, 35 for Z) + check_string = f"{bank_code}{prefix}{main}123500" + + # 2. Calculate checksum + checksum = 98 - (int(check_string) % 97) + checksum_str = str(checksum).zfill(2) + + return f"CZ{checksum_str}{bank_code}{prefix}{main}" + except Exception: + return clean_acc \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..2865bc1 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +qrcode + diff --git a/static/description/bank_account.png b/static/description/bank_account.png new file mode 100644 index 0000000..4509e81 Binary files /dev/null and b/static/description/bank_account.png differ diff --git a/static/description/bank_account_en.png b/static/description/bank_account_en.png new file mode 100644 index 0000000..4716b11 Binary files /dev/null and b/static/description/bank_account_en.png differ diff --git a/static/description/icon.png b/static/description/icon.png new file mode 100644 index 0000000..82ee803 Binary files /dev/null and b/static/description/icon.png differ diff --git a/static/description/index.html b/static/description/index.html new file mode 100644 index 0000000..47b1a37 --- /dev/null +++ b/static/description/index.html @@ -0,0 +1,115 @@ +
+
+
+

Czech QR Payment Generator

+

SPAYD-compliant QR Codes for Invoices

+

+ Add Czech-standard QR codes to your invoices for instant mobile payments. + Compatible with all major Czech banking apps. +

+
+
+
+ +
+
+

Key Features

+
+

SPAYD Standard

+

Generate QR codes in the official Czech SPAYD format, fully compatible with:

+
    +
  • Ceska sporitelna
  • +
  • CSOB
  • +
  • Komercni banka
  • +
  • Raiffeisenbank
  • +
  • And all other major Czech banks
  • +
+

Your customers can simply scan the code with their banking app and pay instantly.

+
+
+

Smart Account Format

+

Enter Czech bank accounts in the familiar local format:

+

123-456/0800

+

The module automatically converts them to IBAN when generating the QR code. + Foreign accounts can be entered directly as IBAN.

+
+
+
+ +
+
+
+
+ Bank account entry +
+
+
+

Easy Setup

+

Simply enter your bank account in the standard Odoo field using the Czech format. + No additional configuration needed.

+

The QR code appears automatically on invoices with CZK currency.

+

Note: For foreign currency invoices, the original Odoo QR code is preserved.

+
+
+
+ +
+
+
+

Seamless Integration

+

Works with standard Odoo invoice templates. No need to modify your existing reports.

+

The QR code is generated automatically and placed in the appropriate position on your invoices.

+
+
+
+ QR payment settings +
+
+
+
+ +
+
+

Frequently Asked Questions

+
+

The QR code is not appearing on my invoices

+

Make sure you have the QR Codes option enabled in your Invoicing app settings + (Settings > Invoicing > Customer Invoices > QR Codes).

+

Which currencies are supported?

+

Czech SPAYD QR codes are generated for invoices in CZK currency only. + For other currencies, the standard Odoo QR code format is used.

+
+
+
+ +
+
+
+

About the Developer

+

+ This module is developed and maintained by Ash technology s.r.o., + an official Odoo partner based in the Czech Republic. +

+

+ This module is free and open-source. We welcome your feedback and feature requests – + if your idea benefits the community, we're happy to include it. +

+

+ Contact us:
+ Web: www.ashtechnology.eu
+ Email: info@ashtechnology.eu +

+

+ For custom Odoo development or larger projects, feel free to reach out. +

+
+
+
+ +
+
+
+

Odoo is a trademark of Odoo S.A.

+
+
+
diff --git a/static/description/qr_payment_main_screenshot.png b/static/description/qr_payment_main_screenshot.png new file mode 100644 index 0000000..0404d89 Binary files /dev/null and b/static/description/qr_payment_main_screenshot.png differ diff --git a/static/description/qr_payment_settings.png b/static/description/qr_payment_settings.png new file mode 100644 index 0000000..0e68cf7 Binary files /dev/null and b/static/description/qr_payment_settings.png differ diff --git a/static/description/qr_payment_settings_en.png b/static/description/qr_payment_settings_en.png new file mode 100644 index 0000000..58eb806 Binary files /dev/null and b/static/description/qr_payment_settings_en.png differ diff --git a/views/report_invoice.xml b/views/report_invoice.xml new file mode 100644 index 0000000..a3a9184 --- /dev/null +++ b/views/report_invoice.xml @@ -0,0 +1,33 @@ + + + \ No newline at end of file