From bb164045b949a14ce2bd475a19a4a99770462730 Mon Sep 17 00:00:00 2001 From: Ashutosh619-sudo Date: Wed, 11 Dec 2024 16:09:52 +0530 Subject: [PATCH 1/6] Fix: Adding default ccc bank account --- .../exports/journal_entry/models.py | 4 +++- ...ng_default_ccc_bank_account_id_and_more.py | 24 +++++++++++++++++++ apps/workspaces/models.py | 2 ++ 3 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py diff --git a/apps/business_central/exports/journal_entry/models.py b/apps/business_central/exports/journal_entry/models.py index f23cfab..baee370 100644 --- a/apps/business_central/exports/journal_entry/models.py +++ b/apps/business_central/exports/journal_entry/models.py @@ -42,9 +42,11 @@ def create_or_update_object(self, accounting_export: AccountingExport, _: Advanc :return: purchase invoices object """ expense = accounting_export.expenses.first() - accounts_payable_account_id = export_settings.default_bank_account_id + if expense.fund_source == 'CCC': + accounts_payable_account_id = export_settings.default_CCC_bank_account_id + advance_setting = AdvancedSetting.objects.get(workspace_id=accounting_export.workspace_id) document_number = expense.expense_number diff --git a/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py b/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py new file mode 100644 index 0000000..73938c2 --- /dev/null +++ b/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py @@ -0,0 +1,24 @@ +# Generated by Django 4.1.2 on 2024-12-11 10:37 + +from django.db import migrations +import ms_business_central_api.models.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('workspaces', '0004_importsetting_charts_of_accounts'), + ] + + operations = [ + migrations.AddField( + model_name='exportsetting', + name='default_CCC_bank_account_id', + field=ms_business_central_api.models.fields.StringNullField(help_text='CCC Bank Account ID', max_length=255, null=True), + ), + migrations.AddField( + model_name='exportsetting', + name='default_CCC_bank_account_name', + field=ms_business_central_api.models.fields.StringNullField(help_text='CCC Bank account name', max_length=255, null=True), + ), + ] diff --git a/apps/workspaces/models.py b/apps/workspaces/models.py index e1a78c3..8e773b9 100644 --- a/apps/workspaces/models.py +++ b/apps/workspaces/models.py @@ -186,6 +186,8 @@ class ExportSetting(BaseModel): ) default_bank_account_name = StringNullField(help_text='Bank account name') default_bank_account_id = StringNullField(help_text='Bank Account ID') + default_CCC_bank_account_name = StringNullField(help_text='CCC Bank account name') + default_CCC_bank_account_id = StringNullField(help_text='CCC Bank Account ID') reimbursable_expense_state = StringOptionsField( choices=REIMBURSABLE_EXPENSE_STATE_CHOICES ) From cbdbfa290e6112a0c92bbd85afd6f00ce62ec480 Mon Sep 17 00:00:00 2001 From: Ashutosh619-sudo Date: Wed, 11 Dec 2024 22:39:19 +0530 Subject: [PATCH 2/6] removing bank account from import settings --- apps/business_central/serializers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/business_central/serializers.py b/apps/business_central/serializers.py index f94c969..d3b2b48 100644 --- a/apps/business_central/serializers.py +++ b/apps/business_central/serializers.py @@ -78,7 +78,8 @@ def format_business_central_fields(self, workspace_id): "ACCOUNT", "EMPLOYEE", "LOCATION", - "COMPANY" + "COMPANY", + "BANK_ACCOUNT" ] attributes = ( DestinationAttribute.objects.filter( From 2743e7bf3b6466a6882442c195fe830b6f4e3f0f Mon Sep 17 00:00:00 2001 From: Ashutosh619-sudo Date: Thu, 12 Dec 2024 22:06:37 +0530 Subject: [PATCH 3/6] bug fixed --- apps/fyle/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/fyle/serializers.py b/apps/fyle/serializers.py index 9440dc2..0029cca 100644 --- a/apps/fyle/serializers.py +++ b/apps/fyle/serializers.py @@ -99,7 +99,7 @@ def format_fyle_fields(self, workspace_id): Get Fyle Fields """ - attribute_types = ['CATEGORY', 'PROJECT', 'COST_CENTER', 'TAX_GROUP', 'CORPORATE_CARD', 'MERCHANT'] + attribute_types = ['EMPLOYEE', 'CATEGORY', 'PROJECT', 'COST_CENTER', 'TAX_GROUP', 'CORPORATE_CARD', 'MERCHANT'] attributes = ExpenseAttribute.objects.filter( ~Q(attribute_type__in=attribute_types), From 2ffea6a04de15e5ae3cbe767a810e97368d95fb9 Mon Sep 17 00:00:00 2001 From: Ashutosh619-sudo Date: Thu, 12 Dec 2024 22:22:22 +0530 Subject: [PATCH 4/6] change name --- ...0005_exportsetting_default_ccc_bank_account_id_and_more.py | 4 ++-- apps/workspaces/models.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py b/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py index 73938c2..a795432 100644 --- a/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py +++ b/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py @@ -13,12 +13,12 @@ class Migration(migrations.Migration): operations = [ migrations.AddField( model_name='exportsetting', - name='default_CCC_bank_account_id', + name='default_ccc_bank_account_id', field=ms_business_central_api.models.fields.StringNullField(help_text='CCC Bank Account ID', max_length=255, null=True), ), migrations.AddField( model_name='exportsetting', - name='default_CCC_bank_account_name', + name='default_ccc_bank_account_name', field=ms_business_central_api.models.fields.StringNullField(help_text='CCC Bank account name', max_length=255, null=True), ), ] diff --git a/apps/workspaces/models.py b/apps/workspaces/models.py index 8e773b9..6e4720a 100644 --- a/apps/workspaces/models.py +++ b/apps/workspaces/models.py @@ -186,8 +186,8 @@ class ExportSetting(BaseModel): ) default_bank_account_name = StringNullField(help_text='Bank account name') default_bank_account_id = StringNullField(help_text='Bank Account ID') - default_CCC_bank_account_name = StringNullField(help_text='CCC Bank account name') - default_CCC_bank_account_id = StringNullField(help_text='CCC Bank Account ID') + default_ccc_bank_account_name = StringNullField(help_text='CCC Bank account name') + default_ccc_bank_account_id = StringNullField(help_text='CCC Bank Account ID') reimbursable_expense_state = StringOptionsField( choices=REIMBURSABLE_EXPENSE_STATE_CHOICES ) From 864592a75cc1fe0f4348850b84f0252a6039ddb3 Mon Sep 17 00:00:00 2001 From: Ashutosh619-sudo Date: Thu, 12 Dec 2024 22:53:48 +0530 Subject: [PATCH 5/6] renamed --- ...ng_default_ccc_bank_account_id_and_more.py | 4 ++-- ...ng_default_ccc_bank_account_id_and_more.py | 23 +++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 apps/workspaces/migrations/0006_rename_default_ccc_bank_account_id_exportsetting_default_ccc_bank_account_id_and_more.py diff --git a/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py b/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py index a795432..73938c2 100644 --- a/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py +++ b/apps/workspaces/migrations/0005_exportsetting_default_ccc_bank_account_id_and_more.py @@ -13,12 +13,12 @@ class Migration(migrations.Migration): operations = [ migrations.AddField( model_name='exportsetting', - name='default_ccc_bank_account_id', + name='default_CCC_bank_account_id', field=ms_business_central_api.models.fields.StringNullField(help_text='CCC Bank Account ID', max_length=255, null=True), ), migrations.AddField( model_name='exportsetting', - name='default_ccc_bank_account_name', + name='default_CCC_bank_account_name', field=ms_business_central_api.models.fields.StringNullField(help_text='CCC Bank account name', max_length=255, null=True), ), ] diff --git a/apps/workspaces/migrations/0006_rename_default_ccc_bank_account_id_exportsetting_default_ccc_bank_account_id_and_more.py b/apps/workspaces/migrations/0006_rename_default_ccc_bank_account_id_exportsetting_default_ccc_bank_account_id_and_more.py new file mode 100644 index 0000000..d07931b --- /dev/null +++ b/apps/workspaces/migrations/0006_rename_default_ccc_bank_account_id_exportsetting_default_ccc_bank_account_id_and_more.py @@ -0,0 +1,23 @@ +# Generated by Django 4.1.2 on 2024-12-12 17:23 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('workspaces', '0005_exportsetting_default_ccc_bank_account_id_and_more'), + ] + + operations = [ + migrations.RenameField( + model_name='exportsetting', + old_name='default_CCC_bank_account_id', + new_name='default_ccc_bank_account_id', + ), + migrations.RenameField( + model_name='exportsetting', + old_name='default_CCC_bank_account_name', + new_name='default_ccc_bank_account_name', + ), + ] From a4896b6b3910beb7bc109cbeb907222928a28de2 Mon Sep 17 00:00:00 2001 From: Ashutosh619-sudo Date: Thu, 12 Dec 2024 22:54:34 +0530 Subject: [PATCH 6/6] change name in JE --- apps/business_central/exports/journal_entry/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/business_central/exports/journal_entry/models.py b/apps/business_central/exports/journal_entry/models.py index baee370..f52f5d3 100644 --- a/apps/business_central/exports/journal_entry/models.py +++ b/apps/business_central/exports/journal_entry/models.py @@ -45,7 +45,7 @@ def create_or_update_object(self, accounting_export: AccountingExport, _: Advanc accounts_payable_account_id = export_settings.default_bank_account_id if expense.fund_source == 'CCC': - accounts_payable_account_id = export_settings.default_CCC_bank_account_id + accounts_payable_account_id = export_settings.default_ccc_bank_account_id advance_setting = AdvancedSetting.objects.get(workspace_id=accounting_export.workspace_id)