Skip to content

Commit

Permalink
Add export url (#91)
Browse files Browse the repository at this point in the history
* Add export url

* fix tests
  • Loading branch information
ruuushhh authored Feb 7, 2024
1 parent e81bee0 commit 9d8aabf
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 4.1.2 on 2024-02-07 08:24

from django.db import migrations
import ms_business_central_api.models.fields


class Migration(migrations.Migration):

dependencies = [
('accounting_exports', '0001_initial'),
]

operations = [
migrations.AddField(
model_name='accountingexport',
name='export_url',
field=ms_business_central_api.models.fields.StringNullField(help_text='Export URL', max_length=255, null=True),
),
]
1 change: 1 addition & 0 deletions apps/accounting_exports/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class AccountingExport(BaseForeignWorkspaceModel):
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")
task_id = StringNullField(help_text='Fyle Jobs task reference')
export_url = StringNullField(help_text='Export URL')
description = CustomJsonField(help_text='Description')
status = StringNotNullField(help_text='Task Status')
detail = CustomJsonField(help_text='Task Response')
Expand Down
1 change: 1 addition & 0 deletions apps/business_central/exports/accounting_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def create_business_central_object(self, accounting_export: AccountingExport):
detail = created_object

accounting_export.detail = detail
accounting_export.export_url = 'https://businesscentral.dynamics.com/'
accounting_export.business_central_errors = None
accounting_export.exported_at = datetime.now()
accounting_export.status = 'COMPLETE'
Expand Down
2 changes: 1 addition & 1 deletion apps/business_central/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def create(self, validated_data):

# Retrieve the workspace and Business Central credentials
workspace = Workspace.objects.get(pk=workspace_id)
business_central_credentials = BusinessCentralCredentials.get_active_business_central_credentials(workspace.id)
business_central_credentials = BusinessCentralCredentials.objects.get(workspace_id=workspace.id)

if refresh_dimension:
# If 'refresh' is true, perform a full sync of dimensions
Expand Down
2 changes: 2 additions & 0 deletions tests/test_fyle/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
"description":[],
"status":"IN_PROGRESS",
"detail":[],
"export_url":"None",
"business_central_errors":[],
"exported_at":"None",
"workspace":1,
Expand All @@ -165,6 +166,7 @@
"description":[],
"status":"IN_PROGRESS",
"detail":[],
"export_url":"None",
"business_central_errors":[],
"exported_at":"None",
"workspace":1,
Expand Down

0 comments on commit 9d8aabf

Please sign in to comment.