Issue : - Liechtenstein adapted the same QR-Invoice as Switzerland. However, Odoo only allows the issuance of QR-Invoices to swiss customers https://www.llb.li/en/private/paying-and-saving/payment-services/qr-bill#:~:text=Standing%20orders%20based%20on%20orange%20payment%20slips%20can%20no%20longer%20be%20processed%20after%2030%20September%202022.%20Therefore%2C%20these%20standing%20orders%20need%20to%20be%20newly%20set%20up%20on%20the%20basis%20of%20QR%20bills. Fix: - Allow LI users to be issued QR-Invoices OPW-2977644 closes odoo/odoo#106239 X-original-commit: 634c7bbe687c850b23e811b4b7e7b7da77313d99 Related: odoo/enterprise#34234 Signed-off-by: Josse Colpaert <jco@odoo.com> Signed-off-by: Mohamed Megahed Abbas Megahed SALLAM (mome) <mome@odoo.com>
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
|
|
|
from odoo import models, fields, api, _
|
|
from odoo.addons.l10n_ch.models.res_bank import _is_l10n_ch_postal
|
|
|
|
class AccountBankStatementLine(models.Model):
|
|
|
|
_inherit = "account.bank.statement.line"
|
|
|
|
def _find_or_create_bank_account(self):
|
|
if self.company_id.account_fiscal_country_id.code in ('CH', 'LI') and _is_l10n_ch_postal(self.account_number):
|
|
bank_account = self.env['res.partner.bank'].search(
|
|
[('company_id', '=', self.company_id.id),
|
|
('sanitized_acc_number', 'like', self.account_number + '%'),
|
|
('partner_id', '=', self.partner_id.id)])
|
|
if not bank_account:
|
|
bank_account = self.env['res.partner.bank'].create({
|
|
'company_id': self.company_id.id,
|
|
'acc_number': self.account_number + " " + self.partner_id.name,
|
|
'partner_id': self.partner_id.id
|
|
})
|
|
return bank_account
|
|
else:
|
|
super(AccountBankStatementLine, self)._find_or_create_bank_account() |