Skip to content

Commit

Permalink
fix: handle post acconting summary
Browse files Browse the repository at this point in the history
  • Loading branch information
GitHub Actions committed Sep 24, 2024
1 parent 5cdede2 commit ce85759
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions apps/netsuite/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,14 +502,14 @@ def create_bill(expense_group: ExpenseGroup, task_log_id, last_export):
expense_group.save()

resolve_errors_for_exported_expense_group(expense_group)
update_complete_expenses(expense_group.expenses.all(), expense_group.export_url)
post_accounting_export_summary(expense_group.workspace.fyle_org_id, expense_group.workspace.id, expense_group.fund_source)
update_complete_expenses(expense_group.expenses.all(), expense_group.export_url)
post_accounting_export_summary(expense_group.workspace.fyle_org_id, expense_group.workspace.id, expense_group.fund_source)

logger.info('Updated Expense Group %s successfully', expense_group.id)
async_task(
'apps.netsuite.tasks.upload_attachments_and_update_export',
expense_group.expenses.all(), task_log, fyle_credentials, expense_group.workspace_id
)
logger.info('Updated Expense Group %s successfully', expense_group.id)
async_task(
'apps.netsuite.tasks.upload_attachments_and_update_export',
expense_group.expenses.all(), task_log, fyle_credentials, expense_group.workspace_id
)


@handle_netsuite_exceptions(payment=False)
Expand Down Expand Up @@ -581,14 +581,14 @@ def create_credit_card_charge(expense_group, task_log_id, last_export):
expense_group.response_logs = created_credit_card_charge
expense_group.export_url = generate_netsuite_export_url(response_logs=created_credit_card_charge, netsuite_credentials=netsuite_credentials)
expense_group.save()
update_complete_expenses(expense_group.expenses.all(), expense_group.export_url)
post_accounting_export_summary(expense_group.workspace.fyle_org_id, expense_group.workspace.id, expense_group.fund_source)

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

credit_card_charge_lineitems_object.netsuite_receipt_url = attachment_links.get(credit_card_charge_lineitems_object.expense.expense_id, None)
credit_card_charge_lineitems_object.save()
update_complete_expenses(expense_group.expenses.all(), expense_group.export_url)
post_accounting_export_summary(expense_group.workspace.fyle_org_id, expense_group.workspace.id, expense_group.fund_source)

credit_card_charge_lineitems_object.netsuite_receipt_url = attachment_links.get(credit_card_charge_lineitems_object.expense.expense_id, None)
credit_card_charge_lineitems_object.save()


@handle_netsuite_exceptions(payment=False)
Expand Down Expand Up @@ -639,14 +639,15 @@ def create_expense_report(expense_group, task_log_id, last_export):
expense_group.export_url = generate_netsuite_export_url(response_logs=created_expense_report, netsuite_credentials=netsuite_credentials)
expense_group.save()
resolve_errors_for_exported_expense_group(expense_group)
update_complete_expenses(expense_group.expenses.all(), expense_group.export_url)
post_accounting_export_summary(expense_group.workspace.fyle_org_id, expense_group.workspace.id, expense_group.fund_source)

logger.info('Updated Expense Group %s successfully', expense_group.id)
async_task(
'apps.netsuite.tasks.upload_attachments_and_update_export',
expense_group.expenses.all(), task_log, fyle_credentials, expense_group.workspace_id
)
update_complete_expenses(expense_group.expenses.all(), expense_group.export_url)
post_accounting_export_summary(expense_group.workspace.fyle_org_id, expense_group.workspace.id, expense_group.fund_source)

logger.info('Updated Expense Group %s successfully', expense_group.id)
async_task(
'apps.netsuite.tasks.upload_attachments_and_update_export',
expense_group.expenses.all(), task_log, fyle_credentials, expense_group.workspace_id
)



Expand Down Expand Up @@ -699,14 +700,15 @@ def create_journal_entry(expense_group, task_log_id, last_export):
expense_group.export_url = generate_netsuite_export_url(response_logs=created_journal_entry, netsuite_credentials=netsuite_credentials)
expense_group.save()
resolve_errors_for_exported_expense_group(expense_group)
update_complete_expenses(expense_group.expenses.all(), expense_group.export_url)
post_accounting_export_summary(expense_group.workspace.fyle_org_id, expense_group.workspace.id, expense_group.fund_source)

logger.info('Updated Expense Group %s successfully', expense_group.id)
async_task(
'apps.netsuite.tasks.upload_attachments_and_update_export',
expense_group.expenses.all(), task_log, fyle_credentials, expense_group.workspace_id
)

update_complete_expenses(expense_group.expenses.all(), expense_group.export_url)
post_accounting_export_summary(expense_group.workspace.fyle_org_id, expense_group.workspace.id, expense_group.fund_source)

logger.info('Updated Expense Group %s successfully', expense_group.id)
async_task(
'apps.netsuite.tasks.upload_attachments_and_update_export',
expense_group.expenses.all(), task_log, fyle_credentials, expense_group.workspace_id
)


def __validate_general_mapping(expense_group: ExpenseGroup, configuration: Configuration) -> List[BulkError]:
Expand Down

0 comments on commit ce85759

Please sign in to comment.