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,