-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
128 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
FYLE_EXPENSE_SYSTEM_FIELDS = [ | ||
'employee id', | ||
'organisation name', | ||
'employee name', | ||
'employee email', | ||
'expense date', | ||
'expense id', | ||
'report id', | ||
'employee id', | ||
'department', | ||
'state', | ||
'reporter', | ||
'report', | ||
'purpose', | ||
'vendor', | ||
'category', | ||
'category code', | ||
'mileage distance', | ||
'mileage unit', | ||
'flight from city', | ||
'flight to city', | ||
'flight from date', | ||
'flight to date', | ||
'flight from class', | ||
'flight to class', | ||
'hotel checkin', | ||
'hotel checkout', | ||
'hotel location', | ||
'hotel breakfast', | ||
'currency', | ||
'amount', | ||
'foreign currency', | ||
'foreign amount', | ||
'tax', | ||
'approver', | ||
'project', | ||
'billable', | ||
'cost center', | ||
'cost center code', | ||
'approved on', | ||
'reimbursable', | ||
'receipts', | ||
'paid date', | ||
'expense created date' | ||
] |
Empty file.
Empty file.
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from django.db import models | ||
|
||
from apps.workspaces.models import BaseForeignWorkspaceModel | ||
from ms_business_central_api.models.fields import ( | ||
CustomDateTimeField, | ||
CustomJsonField, | ||
IntegerNotNullField, | ||
StringNotNullField, | ||
StringOptionsField, | ||
) | ||
|
||
IMPORT_STATUS_CHOICES = ( | ||
('FATAL', 'FATAL'), | ||
('COMPLETE', 'COMPLETE'), | ||
('IN_PROGRESS', 'IN_PROGRESS'), | ||
('FAILED', 'FAILED') | ||
) | ||
|
||
|
||
class ImportLog(BaseForeignWorkspaceModel): | ||
""" | ||
Table to store import logs | ||
""" | ||
|
||
id = models.AutoField(auto_created=True, primary_key=True, verbose_name='ID', serialize=False) | ||
attribute_type = StringNotNullField(max_length=150, help_text='Attribute type') | ||
status = StringOptionsField(help_text='Status', choices=IMPORT_STATUS_CHOICES) | ||
error_log = CustomJsonField(help_text='Emails Selected For Email Notification') | ||
total_batches_count = IntegerNotNullField(help_text='Queued batches', default=0) | ||
processed_batches_count = IntegerNotNullField(help_text='Processed batches', default=0) | ||
last_successful_run_at = CustomDateTimeField(help_text='Last successful run') | ||
|
||
class Meta: | ||
db_table = 'import_logs' | ||
unique_together = ('workspace', 'attribute_type') |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from apps.business_central.utils import BusinessCentralConnector | ||
from apps.workspaces.models import BusinessCentralCredentials | ||
|
||
|
||
def sync_business_central_attributes(business_central_attribute_type: str, workspace_id: int): | ||
business_central_credentials: BusinessCentralCredentials = BusinessCentralCredentials.objects.get(workspace_id=workspace_id) | ||
|
||
business_central_connection = BusinessCentralConnector( | ||
credentials_object=business_central_credentials, | ||
workspace_id=workspace_id | ||
) | ||
|
||
sync_functions = { | ||
'ACCOUNT': business_central_connection.sync_accounts, | ||
'COMPANY': business_central_connection.sync_companies, | ||
'LOCATION': business_central_connection.sync_locations, | ||
'EMPLOYEE': business_central_connection.sync_employees, | ||
'VENDOR': business_central_connection.sync_vendors, | ||
} | ||
|
||
sync_function = sync_functions[business_central_attribute_type] | ||
sync_function() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""ms_business_central_api URL Configuration | ||
The `urlpatterns` list routes URLs to views. For more information please see: | ||
https://docs.djangoproject.com/en/3.0/topics/http/urls/ | ||
Examples: | ||
Function views | ||
1. Add an import: from my_app import views | ||
2. Add a URL to urlpatterns: path('', views.home, name='home') | ||
Class-based views | ||
1. Add an import: from other_app.views import Home | ||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') | ||
Including another URLconf | ||
1. Import the include() function: from django.urls import include, path | ||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) | ||
""" | ||
from django.urls import include, path | ||
|
||
urlpatterns = [ | ||
path('', include('fyle_accounting_mappings.urls')) | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters