From cf1a29068b9f05c868b0ec06c7587fd6f7b3440c Mon Sep 17 00:00:00 2001 From: Anish Kr Singh <116036738+anishfyle@users.noreply.github.com> Date: Thu, 10 Oct 2024 14:27:58 +0530 Subject: [PATCH] fix: default tax code (#654) --- apps/workspaces/apis/import_settings/serializers.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/apps/workspaces/apis/import_settings/serializers.py b/apps/workspaces/apis/import_settings/serializers.py index be8a6956..81fd73b2 100644 --- a/apps/workspaces/apis/import_settings/serializers.py +++ b/apps/workspaces/apis/import_settings/serializers.py @@ -111,6 +111,7 @@ def get_workspace_id(self, instance): def update(self, instance, validated_data): configurations = validated_data.pop('configuration') + general_mappings = validated_data.pop('general_mappings') mapping_settings = validated_data.pop('mapping_settings') configurations_instance, _ = Configuration.objects.update_or_create( @@ -123,6 +124,8 @@ def update(self, instance, validated_data): 'import_netsuite_employees': configurations.get('import_netsuite_employees') }, ) + + GeneralMapping.objects.update_or_create(workspace=instance, defaults={'default_tax_code_name': general_mappings.get('default_tax_code').get('name'), 'default_tax_code_id': general_mappings.get('default_tax_code').get('id')}) trigger: ImportSettingsTrigger = ImportSettingsTrigger(configurations=configurations, mapping_settings=mapping_settings, workspace_id=instance.id)