Skip to content

Commit

Permalink
[FIX] l10n_ch: don't assume the bank account of the company always ha…
Browse files Browse the repository at this point in the history
…s 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.
  • Loading branch information
oco-odoo committed Jan 14, 2020
1 parent 3316fd4 commit 3f30a13
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions addons/l10n_ch/models/res_bank.py
Expand Up @@ -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)
Expand Down

0 comments on commit 3f30a13

Please sign in to comment.