diff --git a/apps/fyle/migrations/0016_auto_20230117_0616.py b/apps/fyle/migrations/0016_auto_20230117_0616.py deleted file mode 100644 index 60df775c..00000000 --- a/apps/fyle/migrations/0016_auto_20230117_0616.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 3.1.14 on 2023-01-17 06:16 - -import apps.fyle.models -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('fyle', '0015_auto_20221104_1049'), - ] - - operations = [ - migrations.AlterField( - model_name='expensegroupsettings', - name='ccc_expense_state', - field=models.CharField(choices=[('APPROVED', 'APPROVED'), ('PAID', 'PAID'), ('PAYMENT_PROCESSING', 'PAYMENT_PROCESSING')], default=apps.fyle.models.get_default_ccc_expense_state, help_text='state at which the ccc expenses are fetched (PAYMENT_PROCESSING /PAID)', max_length=100, null=True), - ), - ] diff --git a/apps/fyle/models.py b/apps/fyle/models.py index 8e7331aa..e8a9d737 100644 --- a/apps/fyle/models.py +++ b/apps/fyle/models.py @@ -169,14 +169,6 @@ def get_default_ccc_expense_group_fields(): def get_default_expense_state(): return 'PAYMENT_PROCESSING' -def get_default_ccc_expense_state(): - return 'PAID' - -CCC_EXPENSE_STATE = ( - ('APPROVED', 'APPROVED'), - ('PAID', 'PAID'), - ('PAYMENT_PROCESSING', 'PAYMENT_PROCESSING') -) class ExpenseGroupSettings(models.Model): """ @@ -201,7 +193,7 @@ class ExpenseGroupSettings(models.Model): max_length=100, default=get_default_expense_state, help_text='state at which the reimbursable expenses are fetched (PAYMENT_PROCESSING / PAID)', null=True) ccc_expense_state = models.CharField( - max_length=100, default=get_default_ccc_expense_state, choices=CCC_EXPENSE_STATE, + max_length=100, default=get_default_expense_state, help_text='state at which the ccc expenses are fetched (PAYMENT_PROCESSING /PAID)', null=True) reimbursable_export_date_type = models.CharField(max_length=100, default='current_date', help_text='Export Date') ccc_export_date_type = models.CharField(max_length=100, default='spent_at', help_text='CCC Export Date') diff --git a/apps/fyle/tasks.py b/apps/fyle/tasks.py index 07ce2ab6..bffb51b8 100644 --- a/apps/fyle/tasks.py +++ b/apps/fyle/tasks.py @@ -102,14 +102,13 @@ def async_create_expense_groups(workspace_id: int, fund_source: List[str], task_ if expenses: workspace.last_synced_at = datetime.now() - reimbursable_expenses_count += len(expenses) + reimbursable_expenses_count = len(expenses) if 'CCC' in fund_source: expenses.extend(platform.expenses.get( source_account_type=['PERSONAL_CORPORATE_CREDIT_CARD_ACCOUNT'], state=expense_group_settings.ccc_expense_state, settled_at=ccc_last_synced_at if expense_group_settings.ccc_expense_state == 'PAYMENT_PROCESSING' else None, - approved_at=ccc_last_synced_at if expense_group_settings.ccc_expense_state == 'APPROVED' else None, filter_credit_expenses=filter_credit_expenses, last_paid_at=ccc_last_synced_at if expense_group_settings.ccc_expense_state == 'PAID' else None )) diff --git a/apps/workspaces/apis/export_settings/serializers.py b/apps/workspaces/apis/export_settings/serializers.py index 5b1f19f6..bfb88162 100644 --- a/apps/workspaces/apis/export_settings/serializers.py +++ b/apps/workspaces/apis/export_settings/serializers.py @@ -29,13 +29,7 @@ class WorkspaceGeneralSettingsSerializer(serializers.ModelSerializer): class Meta: model = WorkspaceGeneralSettings - fields = [ - 'reimbursable_expenses_object', - 'corporate_credit_card_expenses_object', - 'auto_map_employees', - 'is_simplify_report_closure_enabled' - ] - read_only_fields = ['is_simplify_report_closure_enabled'] + fields = ['reimbursable_expenses_object', 'corporate_credit_card_expenses_object', 'auto_map_employees'] class GeneralMappingsSerializer(serializers.ModelSerializer): diff --git a/apps/workspaces/migrations/0032_workspacegeneralsettings_is_simplify_report_closure_enabled.py b/apps/workspaces/migrations/0032_workspacegeneralsettings_is_simplify_report_closure_enabled.py deleted file mode 100644 index 17b141f1..00000000 --- a/apps/workspaces/migrations/0032_workspacegeneralsettings_is_simplify_report_closure_enabled.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.1.14 on 2023-01-19 11:50 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('workspaces', '0031_auto_20221116_0649'), - ] - - operations = [ - migrations.AddField( - model_name='workspacegeneralsettings', - name='is_simplify_report_closure_enabled', - field=models.BooleanField(default=False, help_text='Simplify report closure is enabled'), - ), - ] diff --git a/apps/workspaces/models.py b/apps/workspaces/models.py index c748050f..996bae57 100644 --- a/apps/workspaces/models.py +++ b/apps/workspaces/models.py @@ -123,7 +123,6 @@ class WorkspaceGeneralSettings(models.Model): skip_cards_mapping = models.BooleanField(default=False, help_text='Skip cards mapping') import_tax_codes = models.BooleanField(default=False, help_text='Auto import tax codes to Fyle', null=True) import_customers = models.BooleanField(default=False, help_text='Auto import customers to Fyle') - is_simplify_report_closure_enabled = models.BooleanField(default=False, help_text='Simplify report closure is enabled') created_at = models.DateTimeField(auto_now_add=True, help_text='Created at') updated_at = models.DateTimeField(auto_now=True, help_text='Updated at') charts_of_accounts = ArrayField( diff --git a/requirements.txt b/requirements.txt index de73d4eb..68d21bf8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,8 +15,7 @@ django-rest-framework==0.1.0 djangorestframework==3.11.2 enum34==1.1.10 future==0.18.2 -fyle==0.30.0 -fyle-accounting-mappings==1.22.0 +fyle-accounting-mappings==1.20.0 fyle-integrations-platform-connector==1.22.0 fyle-rest-auth==1.3.1 gunicorn==20.0.4 diff --git a/sql/scripts/017-set-ccc-expense-state.sql b/sql/scripts/017-set-ccc-expense-state.sql deleted file mode 100644 index e806a787..00000000 --- a/sql/scripts/017-set-ccc-expense-state.sql +++ /dev/null @@ -1,7 +0,0 @@ -rollback; -begin; - -update - expense_group_settings -set - ccc_expense_state = expense_state; diff --git a/tests/sql_fixtures/reset_db_fixtures/reset_db.sql b/tests/sql_fixtures/reset_db_fixtures/reset_db.sql index e4b3f5bb..e83795a8 100644 --- a/tests/sql_fixtures/reset_db_fixtures/reset_db.sql +++ b/tests/sql_fixtures/reset_db_fixtures/reset_db.sql @@ -2,8 +2,8 @@ -- PostgreSQL database dump -- --- Dumped from database version 15.1 (Debian 15.1-1.pgdg110+1) --- Dumped by pg_dump version 15.1 (Debian 15.1-1.pgdg100+1) +-- Dumped from database version 14.2 (Debian 14.2-1.pgdg110+1) +-- Dumped by pg_dump version 14.5 (Debian 14.5-1.pgdg100+1) SET statement_timeout = 0; SET lock_timeout = 0; @@ -1387,8 +1387,7 @@ CREATE TABLE public.workspace_general_settings ( charts_of_accounts character varying(100)[] NOT NULL, import_customers boolean NOT NULL, change_accounting_period boolean NOT NULL, - auto_create_merchant_destination_entity boolean NOT NULL, - is_simplify_report_closure_enabled boolean NOT NULL + auto_create_merchant_destination_entity boolean NOT NULL ); @@ -2416,8 +2415,6 @@ COPY public.django_migrations (id, app, name, applied) FROM stdin; 124 mappings 0007_auto_20221102_0630 2022-11-03 06:28:39.216754+00 125 workspaces 0030_auto_20221102_1924 2022-11-03 06:28:39.245951+00 126 fyle 0015_auto_20221104_1049 2022-11-04 11:04:25.882513+00 -127 workspaces 0031_workspacegeneralsettings_is_simplify_report_closure_enabled 2023-01-11 06:28:22.8634+00 -128 fyle 0016_auto_20230117_0616 2023-01-18 09:08:24.092416+00 \. @@ -4819,8 +4816,8 @@ COPY public.users (password, last_login, id, email, user_id, full_name, active, -- Data for Name: workspace_general_settings; Type: TABLE DATA; Schema: public; Owner: postgres -- -COPY public.workspace_general_settings (id, reimbursable_expenses_object, corporate_credit_card_expenses_object, created_at, updated_at, workspace_id, sync_fyle_to_xero_payments, sync_xero_to_fyle_payments, import_categories, auto_map_employees, auto_create_destination_entity, map_merchant_to_contact, skip_cards_mapping, import_tax_codes, charts_of_accounts, import_customers, change_accounting_period, auto_create_merchant_destination_entity, is_simplify_report_closure_enabled) FROM stdin; -1 PURCHASE BILL BANK TRANSACTION 2022-08-02 20:25:24.644164+00 2022-08-02 20:25:24.644209+00 1 f t t EMAIL t t f t {EXPENSE} t t f f +COPY public.workspace_general_settings (id, reimbursable_expenses_object, corporate_credit_card_expenses_object, created_at, updated_at, workspace_id, sync_fyle_to_xero_payments, sync_xero_to_fyle_payments, import_categories, auto_map_employees, auto_create_destination_entity, map_merchant_to_contact, skip_cards_mapping, import_tax_codes, charts_of_accounts, import_customers, change_accounting_period, auto_create_merchant_destination_entity) FROM stdin; +1 PURCHASE BILL BANK TRANSACTION 2022-08-02 20:25:24.644164+00 2022-08-02 20:25:24.644209+00 1 f t t EMAIL t t f t {EXPENSE} t t f \. @@ -4933,7 +4930,7 @@ SELECT pg_catalog.setval('public.django_content_type_id_seq', 37, true); -- Name: django_migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres -- -SELECT pg_catalog.setval('public.django_migrations_id_seq', 128, true); +SELECT pg_catalog.setval('public.django_migrations_id_seq', 126, true); -- diff --git a/tests/test_workspaces/fixtures.py b/tests/test_workspaces/fixtures.py index 2722459d..a48a8f25 100644 --- a/tests/test_workspaces/fixtures.py +++ b/tests/test_workspaces/fixtures.py @@ -3,7 +3,6 @@ 'id':2, 'reimbursable_expenses_object':'PURCHASE BILL', 'corporate_credit_card_expenses_object':'BANK TRANSACTION', - 'is_simplify_report_closure_enabled': True, 'sync_fyle_to_xero_payments':False, 'sync_xero_to_fyle_payments':True, 'map_merchant_to_contact':True, diff --git a/tests/test_workspaces/test_apis/test_export_settings/fixtures.py b/tests/test_workspaces/test_apis/test_export_settings/fixtures.py index 0f7da98a..bbec4158 100644 --- a/tests/test_workspaces/test_apis/test_export_settings/fixtures.py +++ b/tests/test_workspaces/test_apis/test_export_settings/fixtures.py @@ -28,8 +28,7 @@ "workspace_general_settings": { "reimbursable_expenses_object": "PURCHASE BILL", "corporate_credit_card_expenses_object": "BANK TRANSACTION", - "auto_map_employees": "EMAIL", - 'is_simplify_report_closure_enabled': True + "auto_map_employees": "EMAIL" }, "expense_group_settings": { "reimbursable_expense_group_fields": [