From 3751379f1e9a4c215fb6eb898b4ccc67659b9ace Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 10 May 2022 21:51:50 +0700 Subject: initial commit 2 --- addons/l10n_ch/report/__init__.py | 3 + addons/l10n_ch/report/isr_report.xml | 163 +++++++++++++++++++++++++++++++ addons/l10n_ch/report/swissqr_report.py | 22 +++++ addons/l10n_ch/report/swissqr_report.xml | 163 +++++++++++++++++++++++++++++++ 4 files changed, 351 insertions(+) create mode 100644 addons/l10n_ch/report/__init__.py create mode 100644 addons/l10n_ch/report/isr_report.xml create mode 100644 addons/l10n_ch/report/swissqr_report.py create mode 100644 addons/l10n_ch/report/swissqr_report.xml (limited to 'addons/l10n_ch/report') diff --git a/addons/l10n_ch/report/__init__.py b/addons/l10n_ch/report/__init__.py new file mode 100644 index 00000000..304ccd1f --- /dev/null +++ b/addons/l10n_ch/report/__init__.py @@ -0,0 +1,3 @@ +# -*- coding:utf-8 -*- + +from . import swissqr_report \ No newline at end of file diff --git a/addons/l10n_ch/report/isr_report.xml b/addons/l10n_ch/report/isr_report.xml new file mode 100644 index 00000000..58f09b55 --- /dev/null +++ b/addons/l10n_ch/report/isr_report.xml @@ -0,0 +1,163 @@ + + + + + + European A4 without borders + + A4 + Portrait + 0 + 0 + 0 + 0 + + 0 + + + + + ISR + account.move + qweb-pdf + l10n_ch.isr_report_main + l10n_ch.isr_report_main + 'ISR-%s' % object.name + + 'ISR-' + object.name + '.pdf' + True + + + + + + + + + + diff --git a/addons/l10n_ch/report/swissqr_report.py b/addons/l10n_ch/report/swissqr_report.py new file mode 100644 index 00000000..9c3efd91 --- /dev/null +++ b/addons/l10n_ch/report/swissqr_report.py @@ -0,0 +1,22 @@ +# -*- coding:utf-8 -*- + +from odoo import api, models + +class ReportSwissQR(models.AbstractModel): + _name = 'report.l10n_ch.qr_report_main' + _description = 'Swiss QR-bill report' + + @api.model + def _get_report_values(self, docids, data=None): + docs = self.env['account.move'].browse(docids) + + qr_code_urls = {} + for invoice in docs: + qr_code_urls[invoice.id] = invoice.partner_bank_id.build_qr_code_url(invoice.amount_residual, invoice.ref or invoice.name, invoice.payment_reference, invoice.currency_id, invoice.partner_id, qr_method='ch_qr', silent_errors=False) + + return { + 'doc_ids': docids, + 'doc_model': 'account.move', + 'docs': docs, + 'qr_code_urls': qr_code_urls, + } \ No newline at end of file diff --git a/addons/l10n_ch/report/swissqr_report.xml b/addons/l10n_ch/report/swissqr_report.xml new file mode 100644 index 00000000..4d9181f1 --- /dev/null +++ b/addons/l10n_ch/report/swissqr_report.xml @@ -0,0 +1,163 @@ + + + + + + QR-bill + account.move + qweb-pdf + l10n_ch.qr_report_main + l10n_ch.qr_report_main + 'QR-bill-%s' % object.name + + 'QR-bill-' + object.name + '.pdf' + + + + + + + + + -- cgit v1.2.3