Skip to content

Commit

Permalink
import setting bug fix and import of merchant (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
NileshPant1999 authored Nov 20, 2023
1 parent 75418bc commit 1e4f678
Show file tree
Hide file tree
Showing 9 changed files with 63 additions and 69 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.1.2 on 2023-11-06 11:11
# Generated by Django 4.1.2 on 2023-11-17 21:04

from django.db import migrations, models
import django.db.models.deletion
Expand All @@ -7,8 +7,8 @@
class Migration(migrations.Migration):

dependencies = [
('workspaces', '0003_alter_importsetting_workspace'),
('fyle', '0002_dependentfieldsetting'),
('workspaces', '0002_sage300credential_importsetting_fylecredential_and_more'),
('fyle', '0001_initial'),
]

operations = [
Expand Down
2 changes: 1 addition & 1 deletion apps/mappings/imports/modules/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def sync_destination_attributes(self, sage300_attribute_type: str):
'JOB': sage300_connection.sync_jobs,
'COMMITMENT': sage300_connection.sync_commitments,
'VENDOR': sage300_connection.sync_vendors,
'STANDARD_COST_CODES': sage300_connection.sync_standard_cost_codes,
'STANDARD_COST_CODE': sage300_connection.sync_standard_cost_codes,
'ACCOUNT': sage300_connection.sync_accounts,
}

Expand Down
8 changes: 8 additions & 0 deletions apps/mappings/imports/queues.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ def chain_import_fields_to_fyle(workspace_id):
'CATEGORY'
)

if import_settings.import_vendors_as_merchants:
chain.append(
'apps.mappings.imports.tasks.trigger_import_via_schedule',
workspace_id,
'VENDOR',
'MERCHANT'
)

for mapping_setting in mapping_settings:
if mapping_setting.source_field in ['PROJECT', 'COST_CENTER']:
chain.append(
Expand Down
3 changes: 3 additions & 0 deletions apps/sage300/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from django.utils.module_loading import import_string

from apps.workspaces.models import Workspace, Sage300Credential
from apps.mappings.models import Version


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -45,6 +46,8 @@ def sync_dimensions(sage300_credential: Sage300Credential, workspace_id: int) ->
This function syncs dimensions like accounts, vendors, commitments, jobs, categories, and cost codes.
"""

Version.objects.update_or_create(workspace_id=workspace_id)

# Initialize the Sage 300 connection using the provided credentials and workspace ID
sage300_connection = import_string('apps.sage300.utils.SageDesktopConnector')(sage300_credential, workspace_id)

Expand Down
19 changes: 0 additions & 19 deletions apps/workspaces/migrations/0003_alter_importsetting_workspace.py

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Generated by Django 4.1.2 on 2023-11-17 21:06

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


class Migration(migrations.Migration):

dependencies = [
('django_q', '0014_alter_ormq_id_alter_schedule_id'),
('workspaces', '0002_sage300credential_importsetting_fylecredential_and_more'),
]

operations = [
migrations.RenameField(
model_name='workspace',
old_name='ccc_last_synced_at',
new_name='credit_card_last_synced_at',
),
migrations.RenameField(
model_name='workspace',
old_name='last_synced_at',
new_name='reimbursable_last_synced_at',
),
migrations.RemoveField(
model_name='advancedsetting',
name='schedule_id',
),
migrations.AddField(
model_name='advancedsetting',
name='schedule',
field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.PROTECT, to='django_q.schedule'),
),
migrations.AddField(
model_name='advancedsetting',
name='sync_sage_300_to_fyle_payments',
field=sage_desktop_api.models.fields.BooleanFalseField(default=False, help_text='Sync sage 300 to fyle payments'),
),
migrations.AlterField(
model_name='importsetting',
name='workspace',
field=models.OneToOneField(help_text='Reference to Workspace model', on_delete=django.db.models.deletion.PROTECT, related_name='import_settings', to='workspaces.workspace'),
),
]

This file was deleted.

6 changes: 3 additions & 3 deletions apps/workspaces/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ class DependentFieldSettingSerializer(serializers.ModelSerializer):
"""
Dependent Field serializer
"""
cost_code_field_name = serializers.CharField(required=False)
cost_category_field_name = serializers.CharField(required=False)

class Meta:
model = DependentFieldSetting
fields = [
Expand Down Expand Up @@ -303,9 +306,6 @@ def validate(self, data):
if data.get('mapping_settings') is None:
raise serializers.ValidationError('Mapping settings are required')

if not data.get('dependent_field_settings'):
pass

return data


Expand Down

0 comments on commit 1e4f678

Please sign in to comment.