From dda5e1ccb5014bb27d4e6faf032e3e9ed9873124 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 24 Sep 2015 12:29:43 +0200 Subject: [PATCH] FIX Reading wrong field for sequence type of SEPA DD Loop on bank payment lines instead of payment lines --- .../models/bank_payment_line.py | 2 +- .../wizard/export_sdd.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/account_banking_sepa_direct_debit/models/bank_payment_line.py b/account_banking_sepa_direct_debit/models/bank_payment_line.py index 9da270e80..67a0da3f5 100644 --- a/account_banking_sepa_direct_debit/models/bank_payment_line.py +++ b/account_banking_sepa_direct_debit/models/bank_payment_line.py @@ -37,5 +37,5 @@ class BankPaymentLine(models.Model): """ hashcode = super(BankPaymentLine, self).\ move_line_transfer_account_hashcode() - hashcode += self.mandate_id.type + hashcode += '-' + unicode(self.mandate_id.recurrent_sequence_type) return hashcode diff --git a/account_banking_sepa_direct_debit/wizard/export_sdd.py b/account_banking_sepa_direct_debit/wizard/export_sdd.py index ff5662c46..53bdd3d10 100644 --- a/account_banking_sepa_direct_debit/wizard/export_sdd.py +++ b/account_banking_sepa_direct_debit/wizard/export_sdd.py @@ -368,18 +368,18 @@ class BankingExportSddWizard(models.TransientModel): to_expire_mandates = abmo.browse([]) first_mandates = abmo.browse([]) all_mandates = abmo.browse([]) - for line in order.line_ids: - if line.mandate_id in all_mandates: + for bline in order.bank_line_ids: + if bline.mandate_id in all_mandates: continue - all_mandates += line.mandate_id - if line.mandate_id.type == 'oneoff': - to_expire_mandates += line.mandate_id - elif line.mandate_id.type == 'recurrent': - seq_type = line.mandate_id.recurrent_sequence_type + all_mandates += bline.mandate_id + if bline.mandate_id.type == 'oneoff': + to_expire_mandates += bline.mandate_id + elif bline.mandate_id.type == 'recurrent': + seq_type = bline.mandate_id.recurrent_sequence_type if seq_type == 'final': - to_expire_mandates += line.mandate_id + to_expire_mandates += bline.mandate_id elif seq_type == 'first': - first_mandates += line.mandate_id + first_mandates += bline.mandate_id all_mandates.write( {'last_debit_date': fields.Date.context_today(self)}) to_expire_mandates.write({'state': 'expired'})