Skip to content

Commit

Permalink
fix: handle-accounting-export
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Sep 25, 2024
1 parent 8327817 commit 8ddd2d1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions apps/xero/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
from typing import List

from dateutil.relativedelta import relativedelta
from django.utils import timezone as django_timezone

from django.db import transaction
from django.utils import timezone as django_timezone
from fyle_accounting_mappings.models import DestinationAttribute, ExpenseAttribute, Mapping
from fyle_integrations_platform_connector import PlatformConnector
from xerosdk.exceptions import UnsuccessfulAuthentication, WrongParamsError
Expand Down Expand Up @@ -300,7 +299,7 @@ def create_bill(
expense_group.response_logs = created_bill
expense_group.save()
resolve_errors_for_exported_expense_group(expense_group)
generate_export_url_and_update_expense(expense_group, 'BILL')

logger.info('Updated Expense Group %s successfully', expense_group.id)

# Assign billable expenses to customers
Expand All @@ -320,6 +319,11 @@ def create_bill(

attach_customer_to_export(xero_connection, task_log)

try:
generate_export_url_and_update_expense(expense_group, 'BILL')
except Exception as e:
logger.error('Error while updating expenses for expense_group_id: %s and posting accounting export summary %s', expense_group.id, e)

load_attachments(
xero_connection,
created_bill["Invoices"][0]["InvoiceID"],
Expand Down Expand Up @@ -473,7 +477,7 @@ def create_bank_transaction(
expense_group.response_logs = created_bank_transaction
expense_group.save()
resolve_errors_for_exported_expense_group(expense_group)
generate_export_url_and_update_expense(expense_group, 'BANK TRANSACTION')

logger.info('Updated Expense Group %s successfully', expense_group.id)

# Assign billable expenses to customers
Expand All @@ -497,6 +501,10 @@ def create_bank_transaction(

attach_customer_to_export(xero_connection, task_log)

try:
generate_export_url_and_update_expense(expense_group, 'BANK TRANSACTION')
except Exception as e:
logger.error('Error while updating expenses for expense_group_id: %s and posting accounting export summary %s', expense_group.id, e)
load_attachments(
xero_connection,
created_bank_transaction["BankTransactions"][0]["BankTransactionID"],
Expand Down

0 comments on commit 8ddd2d1

Please sign in to comment.