Fix bug with too many reimbursement claims at once
This commit is contained in:
parent
6be52fb718
commit
7d337c92d1
@ -689,13 +689,22 @@ def claim_processing(request):
|
|||||||
num_records = 0
|
num_records = 0
|
||||||
for _, payee_claims in itertools.groupby(claims, key=lambda c: '{}/{}{}/{}'.format(c.payee_name.strip(), c.payee_bsb.strip()[:3], c.payee_bsb.strip()[-3:], c.payee_account.strip())):
|
for _, payee_claims in itertools.groupby(claims, key=lambda c: '{}/{}{}/{}'.format(c.payee_name.strip(), c.payee_bsb.strip()[:3], c.payee_bsb.strip()[-3:], c.payee_account.strip())):
|
||||||
payee_claims = list(payee_claims)
|
payee_claims = list(payee_claims)
|
||||||
|
|
||||||
|
reference = 'RE{}'.format(' '.join(str(c.id) for c in payee_claims))
|
||||||
|
if len(reference) > 18:
|
||||||
|
# Avoid cutting a reference number in half
|
||||||
|
if reference[14] == ' ':
|
||||||
|
reference = reference[:14] + ' etc'
|
||||||
|
else:
|
||||||
|
reference = ' '.join(reference[:14].split()[:-1]) + ' etc'
|
||||||
|
|
||||||
aba.write_detail(
|
aba.write_detail(
|
||||||
aba_file,
|
aba_file,
|
||||||
dest_bsb=payee_claims[0].payee_bsb,
|
dest_bsb=payee_claims[0].payee_bsb,
|
||||||
dest_account=payee_claims[0].payee_account,
|
dest_account=payee_claims[0].payee_account,
|
||||||
cents=sum(c.get_total() for c in payee_claims)*100,
|
cents=sum(c.get_total() for c in payee_claims)*100,
|
||||||
dest_name=payee_claims[0].payee_name[:32],
|
dest_name=payee_claims[0].payee_name[:32],
|
||||||
reference='RE{}'.format(' '.join(str(c.id) for c in payee_claims)),
|
reference=reference,
|
||||||
src_bsb=settings.ABA_SRC_BSB,
|
src_bsb=settings.ABA_SRC_BSB,
|
||||||
src_account=settings.ABA_SRC_ACC,
|
src_account=settings.ABA_SRC_ACC,
|
||||||
src_name=settings.ABA_USER_NAME
|
src_name=settings.ABA_USER_NAME
|
||||||
|
Loading…
Reference in New Issue
Block a user