Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Switzerland - Accounting

Entity: account.move

Compute Method: _compute_l10n_ch_qr_is_valid

Inputs Method Outputs
  • partner_bank_id
  • partner_id
  • currency_id
  • move_type
  • company_id
  • company_id.account_fiscal_country_id
  • company_id.account_fiscal_country_id.code
  • partner_bank_id.account_type
  • partner_bank_id.account_number
for move in self:
            error_messages = move.partner_bank_id._get_error_messages_for_qr('ch_qr', move.partner_id, move.currency_id)
            move.l10n_ch_is_qr_valid = (
                move.move_type == 'out_invoice' and
                not error_messages and
                (
                    # QR codes must be printed on all Swiss transactions
                    move.company_id.account_fiscal_country_id.code == 'CH' or
                    (
                        # QR code is also printed if the fiscal country is not Switzerland but the receivale account is eligible
                        move.partner_bank_id.account_type == 'iban' and
                        (iban := (move.partner_bank_id.account_number or '').replace(' ', '')).startswith('CH') and
                        iban[4:9].isdigit() and
                        30000 <= int(iban[4:9]) <= 31999
                    )
                )
            )

Back to entity