Skip to content

Commit

Permalink
feat: handle posted at (#688)
Browse files Browse the repository at this point in the history
* model changes is posted at null

* update ver platform connector

* ver

* defaults

* updated fixtures

* update fixtures

* migrations

* updated fixtures

* reset db sql

* updated fixtures

* fixtures fixed

* updated fixtures

* fix tests, remove defaults

* feat: auto enable accounting period (#692)

* feat: auto enable accounting period

* migrations resetdb

* platform connector ver
  • Loading branch information
anishfyle committed Nov 18, 2024
1 parent b4c1d86 commit b301368
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 82 deletions.
18 changes: 18 additions & 0 deletions apps/fyle/migrations/0039_expense_is_posted_at_null.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.14 on 2024-11-12 10:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fyle', '0038_expensegroup_export_url'),
]

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'),
),
]
1 change: 1 addition & 0 deletions apps/fyle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class Expense(models.Model):
spent_at = models.DateTimeField(null=True, help_text='Expense spent at')
approved_at = models.DateTimeField(null=True, help_text='Expense approved at')
posted_at = models.DateTimeField(null=True, help_text='Date when the money is taken from the bank')
is_posted_at_null = models.BooleanField(default=False, help_text='Flag check if posted at is null or not')
expense_created_at = models.DateTimeField(help_text='Expense created at')
expense_updated_at = models.DateTimeField(help_text='Expense created at')
created_at = models.DateTimeField(auto_now_add=True, help_text='Created at')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.14 on 2024-11-18 02:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('workspaces', '0046_workspacegeneralsettings_import_code_fields'),
]

operations = [
migrations.AlterField(
model_name='workspacegeneralsettings',
name='change_accounting_period',
field=models.BooleanField(default=True, help_text='Export Expense when accounting period is closed'),
),
]
2 changes: 1 addition & 1 deletion apps/workspaces/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class WorkspaceGeneralSettings(models.Model):
import_items = models.BooleanField(default=False, help_text='Auto import Items to Fyle')
import_projects = models.BooleanField(default=False, help_text='Auto import projects to Fyle')
import_tax_codes = models.BooleanField(default=False, help_text='Auto import tax codes to Fyle', null=True)
change_accounting_period = models.BooleanField(default=False, help_text='Export Expense when accounting period is closed')
change_accounting_period = models.BooleanField(default=True, help_text='Export Expense when accounting period is closed')
charts_of_accounts = ArrayField(base_field=models.CharField(max_length=100), default=get_default_chart_of_accounts, help_text='list of chart of account types to be imported into Fyle')
memo_structure = ArrayField(base_field=models.CharField(max_length=100), default=get_default_memo_fields, help_text='list of system fields for creating custom memo')
auto_map_employees = models.CharField(max_length=50, help_text='Auto Map Employees type from QBO to Fyle', null=True)
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ enum34==1.1.10
future==0.18.2
fyle==0.37.2
fyle-accounting-mappings==1.34.8
fyle-integrations-platform-connector==1.39.1
fyle-integrations-platform-connector==1.39.3
fyle-rest-auth==1.7.4
flake8==4.0.1
gevent==23.9.1
Expand Down
166 changes: 102 additions & 64 deletions tests/sql_fixtures/reset_db_fixtures/reset_db.sql

Large diffs are not rendered by default.

61 changes: 45 additions & 16 deletions tests/test_fyle/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
'tpa_id': 'tpayfjPPHTDgv',
'url': 'https://staging1.fyle.tech/app/settings/#/integrations/native_apps?integrationIframeTarget=integrations/intacct/main/dashboard'
},
'posted_at': '2024-05-10T07:53:25',
'is_posted_at_null': False,
'activity_details': None,
'added_to_report_at': None,
'admin_amount': None,
Expand Down Expand Up @@ -223,7 +225,7 @@
'file_ids': [],
'spent_at': '2024-05-10 17:00:00',
'approved_at': '2024-05-10 07:53:25',
'posted_at': None,
'posted_at': '2024-05-10 07:53:25',
'is_skipped': False,
'expense_created_at': '2024-05-10 07:52:10',
'expense_updated_at': '2024-05-13 05:53:25',
Expand All @@ -239,7 +241,8 @@
'tax_amount': None,
'tax_group_id': None,
'previous_export_state': None,
'accounting_export_summary': []
'accounting_export_summary': [],
'is_posted_at_null': False
},
"expenses_spent_at":[
{
Expand Down Expand Up @@ -283,6 +286,7 @@
'Vehicle Type': '',
'Fyle Categories': '',
},
'is_posted_at_null': False
},
{
'id': '1235',
Expand Down Expand Up @@ -325,6 +329,7 @@
'Vehicle Type': '',
'Fyle Categories': '',
},
'is_posted_at_null': True
},
{
'id': '1236',
Expand Down Expand Up @@ -367,6 +372,7 @@
'Vehicle Type': '',
'Fyle Categories': '',
},
'is_posted_at_null': True
},
],

Expand Down Expand Up @@ -496,7 +502,8 @@
"custom_properties": {
"Vehicle Type": "",
"Fyle Categories": ""
}
},
"is_posted_at_null": False
},
{
"id": "1265",
Expand Down Expand Up @@ -539,8 +546,9 @@
"custom_properties": {
"Vehicle Type": "",
"Fyle Categories": ""
}
}
},
"is_posted_at_null": False
},
],
'expense_refund_single_ccc':{
"id": "1265",
Expand Down Expand Up @@ -583,7 +591,8 @@
"custom_properties": {
"Vehicle Type": "",
"Fyle Categories": ""
}
},
"is_posted_at_null": False
},
'expense_refund_single':{
"id": "1265",
Expand Down Expand Up @@ -619,6 +628,7 @@
"spent_at": "2021-12-22T17:00:00",
"approved_at": "2021-12-22T07:30:26.289842+00:00",
"posted_at": None,
"is_posted_at_null": True,
"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",
Expand Down Expand Up @@ -670,7 +680,8 @@
"custom_properties": {
"Vehicle Type": "",
"Fyle Categories": ""
}
},
"is_posted_at_null": False
},
{
"id": "1111",
Expand Down Expand Up @@ -713,7 +724,8 @@
"custom_properties": {
"Vehicle Type": "",
"Fyle Categories": ""
}
},
"is_posted_at_null": False
}
],
"skipped_expenses": {
Expand Down Expand Up @@ -942,7 +954,8 @@
'paid_on_fyle': False,
'paid_on_qbo': False,
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00'
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'is_posted_at_null': False
},
{
'id': '24009',
Expand Down Expand Up @@ -993,7 +1006,8 @@
'paid_on_fyle': False,
'paid_on_qbo': False,
'created_at': '2024-06-18T19:12:17.020617+00:00',
'updated_at': '2024-06-18T19:12:17.020627+00:00'
'updated_at': '2024-06-18T19:12:17.020627+00:00',
'is_posted_at_null': False
}
],
'ccc_expenses_split_same_bank_transaction_id': [
Expand Down Expand Up @@ -1043,7 +1057,8 @@
'paid_on_qbo': False,
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'anish'
'bank_transaction_id': 'anish',
'is_posted_at_null': False
},
{
'id': '24009',
Expand Down Expand Up @@ -1094,7 +1109,8 @@
'paid_on_qbo': False,
'created_at': '2024-06-18T19:12:17.020617+00:00',
'updated_at': '2024-06-18T19:12:17.020627+00:00',
'bank_transaction_id': 'anish'
'bank_transaction_id': 'anish',
'is_posted_at_null': False
}
],
'ccc_expenses_split_diff_bank_transaction_id': [
Expand Down Expand Up @@ -1145,7 +1161,8 @@
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'Arkham',
'fund_source': 'CCC'
'fund_source': 'CCC',
'is_posted_at_null': False
},
{
'id': '24004',
Expand Down Expand Up @@ -1197,7 +1214,8 @@
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'Arkham',
'fund_source': 'CCC'
'fund_source': 'CCC',
'is_posted_at_null': False
},
{
'id': '24008',
Expand Down Expand Up @@ -1246,7 +1264,8 @@
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'Anish',
'fund_source': 'CCC'
'fund_source': 'CCC',
'is_posted_at_null': False
},
{
'id': '24009',
Expand Down Expand Up @@ -1298,7 +1317,8 @@
'created_at': '2024-06-18T19:12:17.003409+00:00',
'updated_at': '2024-06-18T19:12:17.003421+00:00',
'bank_transaction_id': 'Anish',
'fund_source': 'CCC'
'fund_source': 'CCC',
'is_posted_at_null': False
}
],
'expense_groups_complete_response': {
Expand Down Expand Up @@ -1550,6 +1570,7 @@
'custom_properties': {},
'paid_on_qbo': False,
'payment_number': 'P/2022/05/R/4',
'is_posted_at_null': False
}
],
'fund_source': 'PERSONAL',
Expand Down Expand Up @@ -1643,6 +1664,7 @@
'custom_properties': {},
'paid_on_qbo': False,
'payment_number': 'P/2022/05/R/5',
'is_posted_at_null': False
}
],
'fund_source': 'PERSONAL',
Expand Down Expand Up @@ -2065,6 +2087,7 @@
'exported_at': '2022-05-23T13:03:37.501808Z',
'updated_at': '2022-05-23T13:03:37.502024Z',
'workspace': 3,
'is_posted_at_null': False
},
{
'id': 10,
Expand Down Expand Up @@ -2345,6 +2368,7 @@
'exported_at': '2022-05-23T13:03:15.136482Z',
'updated_at': '2022-05-23T13:03:15.136864Z',
'workspace': 3,
'is_posted_at_null': False
},
{
'id': 9,
Expand Down Expand Up @@ -2735,6 +2759,7 @@
'exported_at': '2022-05-23T13:02:52.066735Z',
'updated_at': '2022-05-23T13:02:52.067152Z',
'workspace': 3,
'is_posted_at_null': False
},
{
'id': 18,
Expand Down Expand Up @@ -10010,6 +10035,7 @@
'Klass': '',
},
'payment_number': 'P/2022/05/R/9',
'is_posted_at_null': False
},
{
'id': 'txW7qE5DUF84',
Expand Down Expand Up @@ -10065,6 +10091,7 @@
'Klass': '',
},
'payment_number': 'P/2022/05/R/9',
'is_posted_at_null': False
},
{
'id': 'txW7qE5DUF85',
Expand Down Expand Up @@ -10120,6 +10147,7 @@
'Klass': '',
},
'payment_number': 'P/2022/05/R/9',
'is_posted_at_null': True,
}
],
'expenses': [
Expand Down Expand Up @@ -10178,6 +10206,7 @@
'Klass': '',
},
'payment_number': 'P/2022/05/R/9',
'is_posted_at_null': False
}
],
'reimbursements': [
Expand Down
1 change: 1 addition & 0 deletions tests/test_workspaces/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
'Klass': '',
},
'payment_number': 'P/2022/05/R/14',
'is_posted_at_null': False
}
],
'company_info': {
Expand Down

0 comments on commit b301368

Please sign in to comment.