From 3f30a13368ecf623cdaa5ab8ae41de6eadc6675f Mon Sep 17 00:00:00 2001 From: oco-odoo Date: Tue, 14 Jan 2020 13:58:07 +0100 Subject: [PATCH] [FIX] l10n_ch: don't assume the bank account of the company always has a currency_id Since this field is not required on res.partner.bank (which is fine: we want it to be synchronized with the journal's currency, which is None if the journal uses company currency), the parameter received by validate_swiss_code_arguments ended out being an empty recordset in case the company was directly in CHF. This caused the QR code to never be displayed in this situation. --- addons/l10n_ch/models/res_bank.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/l10n_ch/models/res_bank.py b/addons/l10n_ch/models/res_bank.py index 7fec01e1ddbe1..3164b4ca94508 100644 --- a/addons/l10n_ch/models/res_bank.py +++ b/addons/l10n_ch/models/res_bank.py @@ -123,9 +123,8 @@ def build_swiss_code_url(self, amount, currency, date_due, debitor, ref_type, re qr_code_url = '/report/barcode/?type=%s&value=%s&width=%s&height=%s&humanreadable=1' % ('QR', werkzeug.url_quote_plus(qr_code_string), 256, 256) return qr_code_url - @api.model def validate_swiss_code_arguments(self, currency, debitor): - + currency = currency or self.company_id.currency_id t_street_comp = '%s %s' % (self.company_id.street if (self.company_id.street != False) else '', self.company_id.street2 if (self.company_id.street2 != False) else '') t_street_deb = '%s %s' % (debitor.street if (debitor.street != False) else '', debitor.street2 if (debitor.street2 != False) else '') number = self.find_number(t_street_comp)