Skip to content

Commit

Permalink
fix circular import
Browse files Browse the repository at this point in the history
  • Loading branch information
NileshPant1999 committed Nov 6, 2023
1 parent b47acdb commit 08ef427
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion apps/fyle/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import List, Dict
from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.utils.module_loading import import_string

from sage_desktop_api.models.fields import (
StringNotNullField,
Expand All @@ -15,7 +16,6 @@
IntegerNotNullField,
)
from apps.workspaces.models import BaseModel, BaseForeignWorkspaceModel
from apps.accounting_exports.models import AccountingExport


EXPENSE_FILTER_RANK = (
Expand Down Expand Up @@ -168,6 +168,9 @@ def create_expense_objects(expenses: List[Dict], workspace_id: int):
}
)

# Doing this to avoid circular import
AccountingExport = import_string('apps.accounting_exports.models.AccountingExport')

# Check if an AccountingExport related to the expense object already exists
if not AccountingExport.objects.filter(expenses__id=expense_object.id).first():
expense_objects.append(expense_object)
Expand Down

0 comments on commit 08ef427

Please sign in to comment.