summaryrefslogtreecommitdiff
path: root/addons/l10n_ch/report/swissqr_report.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/l10n_ch/report/swissqr_report.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/l10n_ch/report/swissqr_report.py')
-rw-r--r--addons/l10n_ch/report/swissqr_report.py22
1 files changed, 22 insertions, 0 deletions
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