diff --git a/apps/accounting_exports/models.py b/apps/accounting_exports/models.py index 4ad511c2..24988b96 100644 --- a/apps/accounting_exports/models.py +++ b/apps/accounting_exports/models.py @@ -4,18 +4,24 @@ StringNotNullField, StringNullField, CustomJsonField, - CustomDateTimeField + CustomDateTimeField, + StringOptionsField ) from apps.workspaces.models import BaseForeignWorkspaceModel from apps.fyle.models import Expense +TYPE_CHOICES = ( + ('FETCH_EXPENSES', 'FETCH_EXPENSES'), + ('INVOICES', 'INVOICES'), + ('DIRECT_COST', 'DIRECT_COST') +) class AccountingExport(BaseForeignWorkspaceModel): """ Table to store accounting exports """ id = models.AutoField(primary_key=True) - type = StringNotNullField(max_length=50, help_text='Task type (FETCH_EXPENSES / INVOICES / DIRECT_COST)') + type = StringOptionsField(choices=TYPE_CHOICES, help_text='Task type') fund_source = StringNotNullField(help_text='Expense fund source') mapping_errors = ArrayField(help_text='Mapping errors', base_field=models.CharField(max_length=255), blank=True, null=True) expenses = models.ManyToManyField(Expense, help_text="Expenses under this Expense Group") @@ -23,7 +29,7 @@ class AccountingExport(BaseForeignWorkspaceModel): description = CustomJsonField(help_text='Description') status = StringNotNullField(help_text='Task Status') detail = CustomJsonField(help_text='Task Response') - sage_intacct_errors = CustomJsonField(help_text='Sage Intacct Errors') + sage_300_errors = CustomJsonField(help_text='Sage 300 Errors') exported_at = CustomDateTimeField(help_text='time of export') class Meta: diff --git a/apps/sage300/models.py b/apps/sage300/models.py index a708cb53..cb164efe 100644 --- a/apps/sage300/models.py +++ b/apps/sage300/models.py @@ -31,7 +31,6 @@ class Invoice(BaseModel): accounting_export = models.OneToOneField(AccountingExport, on_delete=models.PROTECT, help_text='Reference to AccountingExport model') vendor_id = StringNotNullField(help_text='Vendor ID') code = StringNotNullField(max_length=15, help_text="unique key for each document") - discount_amount = FloatNullField(help_text='Discount amount') class Meta: db_table = 'invoice' diff --git a/tests/test_fyle/fixtures.py b/tests/test_fyle/fixtures.py index 5747bb1c..7890f66c 100644 --- a/tests/test_fyle/fixtures.py +++ b/tests/test_fyle/fixtures.py @@ -75,7 +75,7 @@ "description":[], "status":"IN_PROGRESS", "detail":[], - "sage_intacct_errors":[], + "sage_300_errors":[], "exported_at":"None", "workspace":1, "expenses":[] @@ -91,7 +91,7 @@ "description":[], "status":"IN_PROGRESS", "detail":[], - "sage_intacct_errors":[], + "sage_300_errors":[], "exported_at":"None", "workspace":1, "expenses":[]