Skip to content

Commit

Permalink
Merge branch 'master' into github_pr_check_workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-fyle authored Sep 19, 2024
2 parents 30a416a + 9916049 commit 5e35e5c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 4.1.2 on 2024-08-20 08:42

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('fyle_accounting_mappings', '0025_expenseattributesdeletioncache'),
]

operations = [
migrations.AddField(
model_name='destinationattribute',
name='code',
field=models.CharField(help_text='Code of the attribute', max_length=255, null=True),
),
]
12 changes: 6 additions & 6 deletions fyle_accounting_mappings/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ def bulk_create_or_update_destination_attributes(
update: bool = False,
display_name: str = None,
attribute_disable_callback_path: str = None,
is_import_to_fyle_enabled: bool = False
):
"""
Create Destination Attributes in bulk
Expand Down Expand Up @@ -392,9 +393,9 @@ def bulk_create_or_update_destination_attributes(
)
)
else:
if attribute_disable_callback_path and (
(attribute['value'] != primary_key_map[attribute['destination_id']]['value'])
or ('code' in attribute and attribute['code'] != primary_key_map[attribute['destination_id']]['code'])
if attribute_disable_callback_path and is_import_to_fyle_enabled and (
(attribute['value'] and primary_key_map[attribute['destination_id']]['value'] and attribute['value'].lower() != primary_key_map[attribute['destination_id']]['value'].lower())
or ('code' in attribute and attribute['code'] and attribute['code'] != primary_key_map[attribute['destination_id']]['code'])
):
attributes_to_disable[attribute['destination_id']] = {
'value': primary_key_map[attribute['destination_id']]['value'],
Expand All @@ -407,7 +408,7 @@ def bulk_create_or_update_destination_attributes(
(attribute['value'] != primary_key_map[attribute['destination_id']]['value'])
or ('detail' in attribute and attribute['detail'] != primary_key_map[attribute['destination_id']]['detail'])
or ('active' in attribute and attribute['active'] != primary_key_map[attribute['destination_id']]['active'])
or ('code' in attribute and attribute['code'] != primary_key_map[attribute['destination_id']]['code'])
or ('code' in attribute and attribute['code'] and attribute['code'] != primary_key_map[attribute['destination_id']]['code'])
):
attributes_to_be_updated.append(
DestinationAttribute(
Expand All @@ -421,7 +422,7 @@ def bulk_create_or_update_destination_attributes(
)

if attribute_disable_callback_path and attributes_to_disable:
import_string(attribute_disable_callback_path)(workspace_id, attributes_to_disable)
import_string(attribute_disable_callback_path)(workspace_id, attributes_to_disable, is_import_to_fyle_enabled)

if attributes_to_be_created:
DestinationAttribute.objects.bulk_create(attributes_to_be_created, batch_size=50)
Expand All @@ -448,7 +449,6 @@ class Meta:
db_table = 'expense_fields'
unique_together = ('attribute_type', 'workspace_id')


@staticmethod
def create_or_update_expense_fields(attributes: List[Dict], fields_included: List[str], workspace_id):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

setuptools.setup(
name='fyle-accounting-mappings',
version='1.34.1',
version='1.34.4',
author='Shwetabh Kumar',
author_email='[email protected]',
description='Django application to store the fyle accounting mappings in a generic manner',
Expand Down

0 comments on commit 5e35e5c

Please sign in to comment.