From 83800bb0934dd16283b40f055a8a2d2cc108e5d8 Mon Sep 17 00:00:00 2001 From: ruuushhh <66899387+ruuushhh@users.noreply.github.com> Date: Mon, 9 Sep 2024 11:32:59 +0530 Subject: [PATCH] Fix: Foreign Amount (#639) Co-authored-by: GitHub Actions --- apps/netsuite/connector.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/netsuite/connector.py b/apps/netsuite/connector.py index c223070a..015ea28d 100644 --- a/apps/netsuite/connector.py +++ b/apps/netsuite/connector.py @@ -1650,8 +1650,17 @@ def construct_expense_report_lineitems( lines = [] for line in expense_report_lineitems: - expense = Expense.objects.get(pk=line.expense_id) + expense: Expense = Expense.objects.get(pk=line.expense_id) netsuite_custom_segments = line.netsuite_custom_segments + + if expense.foreign_amount: + if expense.amount == 0: + foreign_amount = 0 + else: + foreign_amount = expense.foreign_amount + else: + foreign_amount = None + if attachment_links and expense.expense_id in attachment_links: netsuite_custom_segments.append( { @@ -1734,7 +1743,7 @@ def construct_expense_report_lineitems( 'exchangeRate': None, 'expenseDate': line.transaction_date, 'expMediaItem': None, - 'foreignAmount': expense.foreign_amount if expense.foreign_amount else None, + 'foreignAmount': foreign_amount, 'grossAmt': line.amount, 'isBillable': line.billable, 'isNonReimbursable': None,