Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 17 additions & 0 deletions apps/fyle/migrations/0043_expensegroup_eg_ws_fund_null_idx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.28 on 2026-02-12 08:26

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fyle', '0042_expense_expenses_workspa_ad984e_idx'),
]

operations = [
migrations.AddIndex(
model_name='expensegroup',
index=models.Index(condition=models.Q(('exported_at__isnull', True)), fields=['workspace_id', 'fund_source'], name='eg_ws_fund_null_idx'),
),
]
17 changes: 15 additions & 2 deletions apps/fyle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
from django.contrib.postgres.aggregates import ArrayAgg
from django.contrib.postgres.fields import ArrayField
from django.db import models
from django.db.models import Count, JSONField
from django.db.models import Count, JSONField, Q
from django.db.models.fields.json import KeyTextTransform
from fyle_accounting_library.fyle_platform.constants import IMPORTED_FROM_CHOICES
from fyle_accounting_library.fyle_platform.enums import ExpenseImportSourceEnum
from fyle_accounting_mappings.mixins import AutoAddCreateUpdateInfoMixin
from fyle_accounting_mappings.models import ExpenseAttribute

from apps.users.models import User
from apps.workspaces.enums import (
ExportTypeEnum,
SystemCommentEntityTypeEnum,
SystemCommentIntentEnum,
SystemCommentReasonEnum,
SystemCommentSourceEnum,
)
from apps.workspaces.models import Configuration, Workspace
from apps.workspaces.system_comments import add_system_comment
from apps.workspaces.enums import ExportTypeEnum, SystemCommentEntityTypeEnum, SystemCommentIntentEnum, SystemCommentReasonEnum, SystemCommentSourceEnum

ALLOWED_FIELDS = [
'employee_email', 'report_id', 'claim_number', 'settlement_id',
Expand Down Expand Up @@ -490,6 +496,13 @@ class ExpenseGroup(models.Model):

class Meta:
db_table = 'expense_groups'
indexes = [
models.Index(
fields=['workspace_id', 'fund_source'],
condition=Q(exported_at__isnull=True),
name='eg_ws_fund_null_idx',
),
]

@staticmethod
def create_expense_groups_by_report_id_fund_source(expense_objects: list[Expense], configuration: Configuration, workspace_id: int, system_comments: list = None) -> None:
Expand Down
4 changes: 2 additions & 2 deletions apps/internal/migrations/0001_auto_generated_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class Migration(migrations.Migration):
('fyle', '0036_auto_20250108_0702'),
('users', '0002_auto_20201228_0802'),
('mappings', '0016_auto_20250108_0702'),
('tasks', '0010_alter_tasklog_expense_group'),
('workspaces','0043_configuration_skip_accounting_export_summary_post'),
('tasks', '0016_tasklog_is_attachment_upload_failed'),
('workspaces','0060_workspace_org_settings'),
('sage_intacct', '0030_auto_20241112_0425'),
] # This is the first migration
operations = safe_run_sql(sql_files)
Loading