Merge branch '2.0-fixed' into '2.0'

FIX] l10n_ch_pain_base: check if partner bank is qr iban (reference_type no more set in F2)

See merge request flectra-community/l10n-switzerland-flectra!15
This commit is contained in:
Thomas Winteler 2023-05-09 09:32:17 +00:00
commit 225fe63f2e
2 changed files with 8 additions and 9 deletions

View File

@ -87,14 +87,13 @@ class AccountMove(models.Model):
) )
if ( if (
bank_acc.acc_type not in ["qr-iban", 'iban'] bank_acc.acc_type not in ["qr-iban", 'iban']
and ( and ((
move.currency_id.name == "CHF" move.currency_id.name == "CHF"
and not bank_acc.l10n_ch_isr_subscription_chf and not bank_acc.l10n_ch_isr_subscription_chf
) ) or (
or ( move.currency_id.name == "EUR"
move.currency_id.name == "EUR" and not bank_acc.l10n_ch_isr_subscription_eur
and not bank_acc.l10n_ch_isr_subscription_eur ))
)
): ):
raise exceptions.ValidationError( raise exceptions.ValidationError(
_( _(

View File

@ -10,7 +10,7 @@ class AccountMoveLine(models.Model):
def _prepare_payment_line_vals(self, payment_order): def _prepare_payment_line_vals(self, payment_order):
vals = super(AccountMoveLine, self)._prepare_payment_line_vals( vals = super(AccountMoveLine, self)._prepare_payment_line_vals(
payment_order) payment_order)
if self.move_id and self.move_id.reference_type in ['isr', 'QRR', 'SCOR']: if self.move_id and self.move_id.partner_bank_id._is_qr_iban():
if self.move_id.reference_type == 'isr': if self.move_id.reference_type == 'isr':
vals['local_instrument'] = 'CH01' vals['local_instrument'] = 'CH01'
if vals['communication']: if vals['communication']: