From 2e6fde4d27bebf930faf82444bbfbd5090ae6e1e Mon Sep 17 00:00:00 2001 From: Anish Kr Singh <116036738+anishfyle@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:26:59 +0530 Subject: [PATCH] fix: fix posted_at_null migrations (#229) * fix: fix posted_at_null migrations * fyle-integrations-platform-connector * defaults * 1.39.3 * update fixtures --- .../0005_expense_is_posted_at_null.py | 18 ++++++++++++++++++ apps/fyle/models.py | 1 + requirements.txt | 2 +- tests/test_fyle/fixtures.py | 7 +++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 apps/fyle/migrations/0005_expense_is_posted_at_null.py diff --git a/apps/fyle/migrations/0005_expense_is_posted_at_null.py b/apps/fyle/migrations/0005_expense_is_posted_at_null.py new file mode 100644 index 00000000..134ea430 --- /dev/null +++ b/apps/fyle/migrations/0005_expense_is_posted_at_null.py @@ -0,0 +1,18 @@ +# Generated by Django 4.1.2 on 2024-11-26 06:36 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('fyle', '0004_remove_expense_settlement_id'), + ] + + operations = [ + migrations.AddField( + model_name='expense', + name='is_posted_at_null', + field=models.BooleanField(default=False, help_text='Flag check if posted at is null or not'), + ), + ] diff --git a/apps/fyle/models.py b/apps/fyle/models.py index e55692bc..d3a1fb09 100644 --- a/apps/fyle/models.py +++ b/apps/fyle/models.py @@ -164,6 +164,7 @@ def create_expense_objects(expenses: List[Dict], workspace_id: int, skip_update: 'report_id': expense['report_id'], 'spent_at': expense['spent_at'], 'posted_at': expense['posted_at'], + 'is_posted_at_null': expense['is_posted_at_null'], 'fund_source': SOURCE_ACCOUNT_MAP[expense['source_account_type']], 'verified_at': expense['verified_at'], 'custom_properties': expense['custom_properties'], diff --git a/requirements.txt b/requirements.txt index ef5a7d16..871acdeb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,7 +29,7 @@ fyle==0.37.0 # Reusable Fyle Packages fyle-rest-auth==1.7.2 fyle-accounting-mappings==1.34.8 -fyle-integrations-platform-connector==1.39.1 +fyle-integrations-platform-connector==1.39.3 # Postgres Dependincies diff --git a/tests/test_fyle/fixtures.py b/tests/test_fyle/fixtures.py index c7548c27..841218ed 100644 --- a/tests/test_fyle/fixtures.py +++ b/tests/test_fyle/fixtures.py @@ -224,6 +224,7 @@ 'spent_at': '2024-05-10 17:00:00', 'approved_at': '2024-05-10 07:53:25', 'posted_at': None, + 'is_posted_at_null': True, 'is_skipped': False, 'expense_created_at': '2024-05-10 07:52:10', 'expense_updated_at': '2024-05-13 05:53:25', @@ -700,6 +701,7 @@ 'spent_at': '2021-12-22T07:30:26.289842+00:00', 'approved_at': '2021-12-22T07:30:26.289842+00:00', 'posted_at': '2021-12-22T07:30:26.289842+00:00', + 'is_posted_at_null': False, 'expense_created_at': '2021-12-23T07:14:13.990650+00:00', 'expense_updated_at': '2021-12-27T05:26:43.954470+00:00', 'source_account_type': 'PERSONAL_CASH_ACCOUNT', @@ -745,6 +747,7 @@ 'spent_at': '2020-12-22T07:30:26.289842+00:00', 'approved_at': '2020-12-22T07:30:26.289842+00:00', 'posted_at': '2021-12-22T07:30:26.289842+00:00', + 'is_posted_at_null': False, 'expense_created_at': '2020-12-23T07:14:13.990650+00:00', 'expense_updated_at': '2020-12-27T05:26:43.954470+00:00', 'source_account_type': 'PERSONAL_CASH_ACCOUNT', @@ -788,6 +791,7 @@ 'spent_at': '2021-12-22T07:30:26.289842+00:00', 'approved_at': '2021-12-22T07:30:26.289842+00:00', 'posted_at': '2021-12-22T07:30:26.289842+00:00', + 'is_posted_at_null': False, 'expense_created_at': '2021-12-23T07:14:13.990650+00:00', 'expense_updated_at': '2021-12-27T05:26:43.954470+00:00', 'source_account_type': 'PERSONAL_CASH_ACCOUNT', @@ -829,6 +833,7 @@ 'spent_at': '2021-12-22T07:30:26.289842+00:00', 'approved_at': '2021-12-22T07:30:26.289842+00:00', 'posted_at': '2021-12-22T07:30:26.289842+00:00', + 'is_posted_at_null': False, 'expense_created_at': '2021-12-23T07:14:13.990650+00:00', 'expense_updated_at': '2021-12-27T05:26:43.954470+00:00', 'source_account_type': 'PERSONAL_CASH_ACCOUNT', @@ -872,6 +877,7 @@ 'spent_at': '2021-12-22T07:30:26.289842+00:00', 'approved_at': '2021-12-22T07:30:26.289842+00:00', 'posted_at': '2021-12-22T07:30:26.289842+00:00', + 'is_posted_at_null': False, 'expense_created_at': '2021-12-23T07:14:13.990650+00:00', 'expense_updated_at': '2021-12-27T05:26:43.954470+00:00', 'source_account_type': 'PERSONAL_CASH_ACCOUNT', @@ -913,6 +919,7 @@ 'spent_at': '2021-12-2T07:30:26.289842+00:00', 'approved_at': '2021-12-22T07:30:26.289842+00:00', 'posted_at': '2021-12-22T07:30:26.289842+00:00', + 'is_posted_at_null': False, 'expense_created_at': '2021-12-23T07:14:13.990650+00:00', 'expense_updated_at': '2021-12-27T05:26:43.954470+00:00', 'source_account_type': 'PERSONAL_CASH_ACCOUNT',