[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.

closes odoo/odoo#43351

X-original-commit: 60a55834b5ae0a8ac10914a243f97029d9921ae6
Signed-off-by: Laurent Smet <smetl@users.noreply.github.com>
This commit is contained in:
oco-odoo
2020-01-15 14:01:34 +00:00
parent 1aaf095a1a
commit aea045d446
+1 -2
View File
@@ -151,9 +151,8 @@ class ResPartnerBank(models.Model):
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)