Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Direct export Expense Model Changes #416

Merged
merged 2 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions apps/fyle/migrations/0029_auto_20240130_0815.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Generated by Django 3.1.14 on 2024-01-30 08:15

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('workspaces', '0032_auto_20230810_0702'),
('fyle', '0028_remove_expensegroupsettings_import_card_credits'),
]

operations = [
migrations.AddField(
model_name='expense',
name='accounting_export_summary',
field=models.JSONField(default=dict),
),
migrations.AddField(
model_name='expense',
name='previous_export_state',
field=models.CharField(help_text='Previous export state', max_length=255, null=True),
),
migrations.AddField(
model_name='expense',
name='workspace',
field=models.ForeignKey(help_text='To which workspace this expense belongs to', null=True, on_delete=django.db.models.deletion.PROTECT, to='workspaces.workspace'),
),
]
5 changes: 5 additions & 0 deletions apps/fyle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ class Expense(models.Model):
corporate_card_id = models.CharField(max_length=255, null=True, blank=True, help_text='Corporate Card ID')
is_skipped = models.BooleanField(null=True, default=False, help_text='Expense is skipped or not')
report_title = models.TextField(null=True, blank=True, help_text='Report title')
accounting_export_summary = JSONField(default=dict)
previous_export_state = models.CharField(max_length=255, help_text='Previous export state', null=True)
workspace = models.ForeignKey(
ruuushhh marked this conversation as resolved.
Show resolved Hide resolved
Workspace, on_delete=models.PROTECT, help_text='To which workspace this expense belongs to', null=True
)

class Meta:
db_table = 'expenses'
Expand Down
35 changes: 27 additions & 8 deletions tests/sql_fixtures/reset_db_fixtures/reset_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-- PostgreSQL database dump
--

-- Dumped from database version 15.3 (Debian 15.3-1.pgdg120+1)
-- Dumped by pg_dump version 15.4 (Debian 15.4-1.pgdg100+1)
-- Dumped from database version 15.5 (Debian 15.5-1.pgdg120+1)
-- Dumped by pg_dump version 15.5 (Debian 15.5-1.pgdg120+1)

SET statement_timeout = 0;
SET lock_timeout = 0;
Expand Down Expand Up @@ -1102,7 +1102,10 @@ CREATE TABLE public.expenses (
is_skipped boolean,
report_title text,
posted_at timestamp with time zone,
employee_name character varying(255)
employee_name character varying(255),
accounting_export_summary jsonb NOT NULL,
previous_export_state character varying(255),
workspace_id integer
);


Expand Down Expand Up @@ -4028,6 +4031,7 @@ COPY public.django_migrations (id, app, name, applied) FROM stdin;
167 fyle_accounting_mappings 0023_auto_20230918_1316 2023-10-19 10:40:26.096281+00
168 fyle_accounting_mappings 0024_auto_20230922_0819 2023-10-19 10:40:26.190138+00
169 mappings 0015_importlog 2023-10-19 10:40:26.232859+00
170 fyle 0029_auto_20240130_0815 2024-01-30 08:16:09.353842+00
\.


Expand Down Expand Up @@ -7456,10 +7460,10 @@ COPY public.expense_reports (id, employee_id, description, supdoc_id, created_at
-- Data for Name: expenses; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.expenses (id, employee_email, category, sub_category, project, expense_id, expense_number, claim_number, amount, currency, foreign_amount, foreign_currency, settlement_id, reimbursable, state, vendor, cost_center, purpose, report_id, spent_at, approved_at, expense_created_at, expense_updated_at, created_at, updated_at, fund_source, custom_properties, verified_at, billable, paid_on_sage_intacct, org_id, tax_amount, tax_group_id, file_ids, payment_number, corporate_card_id, is_skipped, report_title, posted_at, employee_name) FROM stdin;
1 [email protected] Food \N Aaron Abbott txR9dyrqr1Jn E/2022/09/T/21 C/2022/09/R/21 21 USD \N \N setqwcKcC9q1k t PAYMENT_PROCESSING Ashwin Marketing \N rpEZGqVCyWxQ 2022-09-20 17:00:00+00 2022-09-19 19:54:36.96+00 2022-09-19 19:54:15.870239+00 2022-09-19 19:55:58.641995+00 2022-09-20 08:48:21.737374+00 2022-09-20 08:48:21.737392+00 PERSONAL {"Team": "", "Class": "", "Klass": "", "Location": "", "Team Copy": "", "Tax Groups": "", "Departments": "", "Team 2 Postman": "", "User Dimension": "", "Location Entity": "", "Operating System": "", "System Operating": "", "User Dimension Copy": "", "Custom Expense Field": null} \N \N f or79Cob97KSh \N \N {} P/2022/09/R/18 \N f \N \N \N
2 [email protected] Food \N Aaron Abbott txCqLqsEnAjf E/2022/09/T/22 C/2022/09/R/22 11 USD \N \N setzhjuqQ6Pl5 f PAYMENT_PROCESSING Ashwin Marketing \N rpSTYO8AfUVA 2022-09-20 17:00:00+00 2022-09-20 08:50:48.428+00 2022-09-20 08:50:27.570399+00 2022-09-20 08:51:13.891379+00 2022-09-20 08:51:27.566571+00 2022-09-20 08:51:27.566598+00 CCC {"Team": "", "Class": "", "Klass": "", "Location": "", "Team Copy": "", "Tax Groups": "", "Departments": "", "Team 2 Postman": "", "User Dimension": "", "Location Entity": "", "Operating System": "", "System Operating": "", "User Dimension Copy": "", "Custom Expense Field": null} \N t f or79Cob97KSh 2.41 tggu76WXIdjY {} P/2022/09/R/19 \N f \N \N \N
3 [email protected] Taxi \N Aaron Abbott txTHfEPWOEOp E/2022/09/T/23 C/2022/09/R/23 22 USD \N \N set0SnAq66Zbq f PAYMENT_PROCESSING Ashwin Marketing \N rpBf5ibqUT6B 2022-09-20 17:00:00+00 2022-09-20 08:56:09.337+00 2022-09-20 08:55:53.246893+00 2022-09-20 08:56:40.795304+00 2022-09-20 08:56:50.117313+00 2022-09-20 08:56:50.117349+00 CCC {"Team": "", "Class": "", "Klass": "", "Location": "", "Team Copy": "", "Tax Groups": "", "Departments": "", "Team 2 Postman": "", "User Dimension": "", "Location Entity": "", "Operating System": "", "System Operating": "", "User Dimension Copy": "", "Custom Expense Field": null} \N \N f or79Cob97KSh 4.81 tggu76WXIdjY {} P/2022/09/R/20 \N f \N \N \N
COPY public.expenses (id, employee_email, category, sub_category, project, expense_id, expense_number, claim_number, amount, currency, foreign_amount, foreign_currency, settlement_id, reimbursable, state, vendor, cost_center, purpose, report_id, spent_at, approved_at, expense_created_at, expense_updated_at, created_at, updated_at, fund_source, custom_properties, verified_at, billable, paid_on_sage_intacct, org_id, tax_amount, tax_group_id, file_ids, payment_number, corporate_card_id, is_skipped, report_title, posted_at, employee_name, accounting_export_summary, previous_export_state, workspace_id) FROM stdin;
1 [email protected] Food \N Aaron Abbott txR9dyrqr1Jn E/2022/09/T/21 C/2022/09/R/21 21 USD \N \N setqwcKcC9q1k t PAYMENT_PROCESSING Ashwin Marketing \N rpEZGqVCyWxQ 2022-09-20 17:00:00+00 2022-09-19 19:54:36.96+00 2022-09-19 19:54:15.870239+00 2022-09-19 19:55:58.641995+00 2022-09-20 08:48:21.737374+00 2022-09-20 08:48:21.737392+00 PERSONAL {"Team": "", "Class": "", "Klass": "", "Location": "", "Team Copy": "", "Tax Groups": "", "Departments": "", "Team 2 Postman": "", "User Dimension": "", "Location Entity": "", "Operating System": "", "System Operating": "", "User Dimension Copy": "", "Custom Expense Field": null} \N \N f or79Cob97KSh \N \N {} P/2022/09/R/18 \N f \N \N \N {} \N \N
2 [email protected] Food \N Aaron Abbott txCqLqsEnAjf E/2022/09/T/22 C/2022/09/R/22 11 USD \N \N setzhjuqQ6Pl5 f PAYMENT_PROCESSING Ashwin Marketing \N rpSTYO8AfUVA 2022-09-20 17:00:00+00 2022-09-20 08:50:48.428+00 2022-09-20 08:50:27.570399+00 2022-09-20 08:51:13.891379+00 2022-09-20 08:51:27.566571+00 2022-09-20 08:51:27.566598+00 CCC {"Team": "", "Class": "", "Klass": "", "Location": "", "Team Copy": "", "Tax Groups": "", "Departments": "", "Team 2 Postman": "", "User Dimension": "", "Location Entity": "", "Operating System": "", "System Operating": "", "User Dimension Copy": "", "Custom Expense Field": null} \N t f or79Cob97KSh 2.41 tggu76WXIdjY {} P/2022/09/R/19 \N f \N \N \N {} \N \N
3 [email protected] Taxi \N Aaron Abbott txTHfEPWOEOp E/2022/09/T/23 C/2022/09/R/23 22 USD \N \N set0SnAq66Zbq f PAYMENT_PROCESSING Ashwin Marketing \N rpBf5ibqUT6B 2022-09-20 17:00:00+00 2022-09-20 08:56:09.337+00 2022-09-20 08:55:53.246893+00 2022-09-20 08:56:40.795304+00 2022-09-20 08:56:50.117313+00 2022-09-20 08:56:50.117349+00 CCC {"Team": "", "Class": "", "Klass": "", "Location": "", "Team Copy": "", "Tax Groups": "", "Departments": "", "Team 2 Postman": "", "User Dimension": "", "Location Entity": "", "Operating System": "", "System Operating": "", "User Dimension Copy": "", "Custom Expense Field": null} \N \N f or79Cob97KSh 4.81 tggu76WXIdjY {} P/2022/09/R/20 \N f \N \N \N {} \N \N
\.


Expand Down Expand Up @@ -8027,7 +8031,7 @@ SELECT pg_catalog.setval('public.django_content_type_id_seq', 49, true);
-- Name: django_migrations_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--

SELECT pg_catalog.setval('public.django_migrations_id_seq', 169, true);
SELECT pg_catalog.setval('public.django_migrations_id_seq', 170, true);


--
Expand Down Expand Up @@ -9248,6 +9252,13 @@ CREATE INDEX expense_report_lineitems_expense_report_id_4c7e2508 ON public.expen
CREATE INDEX expenses_expense_id_0e3511ea_like ON public.expenses USING btree (expense_id varchar_pattern_ops);


--
-- Name: expenses_workspace_id_72fb819f; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX expenses_workspace_id_72fb819f ON public.expenses USING btree (workspace_id);


--
-- Name: fyle_accounting_mappings_d_workspace_id_a6a3ab6a; Type: INDEX; Schema: public; Owner: postgres
--
Expand Down Expand Up @@ -9697,6 +9708,14 @@ ALTER TABLE ONLY public.expense_reports
ADD CONSTRAINT expense_reports_expense_group_id_3f864e9a_fk_expense_groups_id FOREIGN KEY (expense_group_id) REFERENCES public.expense_groups(id) DEFERRABLE INITIALLY DEFERRED;


--
-- Name: expenses expenses_workspace_id_72fb819f_fk_workspaces_id; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.expenses
ADD CONSTRAINT expenses_workspace_id_72fb819f_fk_workspaces_id FOREIGN KEY (workspace_id) REFERENCES public.workspaces(id) DEFERRABLE INITIALLY DEFERRED;


--
-- Name: mappings fyle_accounting_mapp_workspace_id_10d6edd3_fk_workspace; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
Expand Down
Loading