[FIX] l10n_ch_pain_base: check partner_bank_id on move_id to prevent expected singleton error

This commit is contained in:
Thomas Winteler 2023-06-05 07:29:31 +02:00
parent c19e530d6b
commit 3c67e56bf2

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.partner_bank_id._is_qr_iban(): if self.move_id and self.move_id.partner_bank_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']: