From 8046648273c778c235da9ea42303ada35d7f322b Mon Sep 17 00:00:00 2001 From: Emanuel Cino Date: Thu, 22 Jun 2023 11:48:59 +0200 Subject: [PATCH] [FIX] pain modules not working Fix pain modules problems --- l10n_ch_pain_base/models/account_move_line.py | 2 +- l10n_ch_pain_base/models/account_payment_order.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/l10n_ch_pain_base/models/account_move_line.py b/l10n_ch_pain_base/models/account_move_line.py index caf198601..a9bda5d40 100644 --- a/l10n_ch_pain_base/models/account_move_line.py +++ b/l10n_ch_pain_base/models/account_move_line.py @@ -11,7 +11,7 @@ def _prepare_payment_line_vals(self, payment_order): vals = super()._prepare_payment_line_vals(payment_order) if ( self.move_id - and self.move_id._is_isr_reference() + and self.move_id._has_isr_ref() and self.move_id.partner_bank_id ): if self.move_id.partner_bank_id._is_qr_iban(): diff --git a/l10n_ch_pain_base/models/account_payment_order.py b/l10n_ch_pain_base/models/account_payment_order.py index 2a9d45981..7b86930b4 100644 --- a/l10n_ch_pain_base/models/account_payment_order.py +++ b/l10n_ch_pain_base/models/account_payment_order.py @@ -76,7 +76,7 @@ def generate_party_agent( self, parent_node, party_type, order, partner_bank, gen_args, bank_line=None ): if gen_args.get("pain_flavor") == "pain.001.001.03.ch.02" and bank_line: - if bank_line.local_instrument == "CH01": + if bank_line.payment_line_ids[:1].local_instrument == "CH01": # Don't set the creditor agent on ISR/CH01 payments return True elif not partner_bank.bank_bic: @@ -104,7 +104,7 @@ def generate_party_acc_number( if ( gen_args.get("pain_flavor") == "pain.001.001.03.ch.02" and bank_line - and bank_line.local_instrument == "CH01" + and bank_line.payment_line_ids[:1].local_instrument == "CH01" ): if not partner_bank.l10n_ch_postal: raise UserError( @@ -159,7 +159,7 @@ def generate_address_block(self, parent_node, partner, gen_args): @api.model def generate_remittance_info_block(self, parent_node, line, gen_args): - if line.communication_type == "qrr": + if line.payment_line_ids[:1].communication_type == "qrr": remittance_info = etree.SubElement(parent_node, "RmtInf") remittance_info_structured = etree.SubElement(remittance_info, "Strd") creditor_ref_information = etree.SubElement(