FIX Reading wrong field for sequence type of SEPA DD

Loop on bank payment lines instead of payment lines
This commit is contained in:
Alexis de Lattre
2015-09-24 12:29:43 +02:00
committed by Pedro M. Baeza
parent fc4b88c2db
commit dda5e1ccb5
2 changed files with 10 additions and 10 deletions

View File

@@ -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

View File

@@ -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'})