Include claim purpose when exporting to Xero

This commit is contained in:
Yingtong Li 2020-05-13 11:18:57 +10:00
parent 787b16733d
commit bbd775789f
Signed by: RunasSudo
GPG Key ID: 7234E476BF21C61A

View File

@ -27,13 +27,13 @@ def write_row(writer, d):
writer.writerow(d) writer.writerow(d)
def write_claim(writer, claim): def write_claim(writer, claim):
for item in claim.items: for i, item in enumerate(claim.items):
write_row(writer, { write_row(writer, {
'*ContactName': claim.payee_name, '*ContactName': claim.payee_name,
'*InvoiceNumber': 'RE-{}'.format(claim.id), '*InvoiceNumber': 'RE-{}'.format(claim.id),
'*InvoiceDate': timezone.now().strftime('%d/%m/%Y'), '*InvoiceDate': timezone.now().strftime('%d/%m/%Y'),
'*DueDate': timezone.now().strftime('%d/%m/%Y'), '*DueDate': timezone.now().strftime('%d/%m/%Y'),
'Description': item['Description'], 'Description': '{} - {}'.format(claim.purpose, item['Description']) if i == 0 else item['Description'],
'*Quantity': str(item['Units']), '*Quantity': str(item['Units']),
'*UnitAmount': str(item['Unit price']), '*UnitAmount': str(item['Unit price']),
#'*AccountCode': '850', # Suspense #'*AccountCode': '850', # Suspense