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

Fix: Remove code for adding department in expense group settings #665

Merged
merged 1 commit into from
Nov 14, 2024
Merged
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
24 changes: 0 additions & 24 deletions apps/workspaces/apis/import_settings/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,6 @@ def add_department_grouping(self, source_field: str):

expense_group_settings.save()

def __update_expense_group_settings_for_departments(self):
"""
Should group expenses by department source field in case the export is journal entries
"""
department_setting = list(filter(lambda setting: setting['destination_field'] == 'DEPARTMENT', self.__mapping_settings))

if department_setting:
department_setting = department_setting[0]

self.add_department_grouping(department_setting['source_field'])

def post_save_configurations(self, configurations_instance: Configuration):
"""
Expand All @@ -77,16 +67,6 @@ def post_save_configurations(self, configurations_instance: Configuration):
mapping_settings=self.__mapping_settings
)

def __remove_old_department_source_field(self, current_mappings_settings: List[MappingSetting], new_mappings_settings: List[Dict]):
"""
Should remove Department Source field from Reimbursable settings in case of deletion and updation
"""
old_department_setting = current_mappings_settings.filter(destination_field='DEPARTMENT').first()

new_department_setting = list(filter(lambda setting: setting['destination_field'] == 'DEPARTMENT', new_mappings_settings))

if old_department_setting and new_department_setting and old_department_setting.source_field != new_department_setting[0]['source_field']:
self.remove_department_grouping(old_department_setting.source_field.lower())

def __unset_auto_mapped_flag(self, current_mapping_settings: List[MappingSetting], new_mappings_settings: List[Dict]):
"""
Expand Down Expand Up @@ -119,8 +99,6 @@ def pre_save_mapping_settings(self):

# Update department mapping to some other Fyle field
current_mapping_settings = MappingSetting.objects.filter(workspace_id=self.__workspace_id).all()

self.__remove_old_department_source_field(current_mappings_settings=current_mapping_settings, new_mappings_settings=mapping_settings)
self.__unset_auto_mapped_flag(current_mapping_settings=current_mapping_settings, new_mappings_settings=mapping_settings)

def post_save_mapping_settings(self, configurations_instance: Configuration):
Expand All @@ -139,8 +117,6 @@ def post_save_mapping_settings(self, configurations_instance: Configuration):

MappingSetting.objects.filter(~Q(destination_field__in=destination_fields), workspace_id=self.__workspace_id).delete()

self.__update_expense_group_settings_for_departments()

new_schedule_or_delete_fyle_import_tasks(
configuration_instance=configurations_instance,
mapping_settings=self.__mapping_settings
Expand Down
Loading