Skip to content

Commit

Permalink
Adding is_mandatory flag correctly while uploading custom fields (#402)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shwetabhk authored Mar 31, 2023
1 parent f1b5be5 commit d5e84c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apps/mappings/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -936,9 +936,11 @@ def create_fyle_expense_custom_field_payload(

custom_field_id = None
placeholder = None
is_mandatory = False
if existing_attribute is not None:
custom_field_id = existing_attribute['custom_field_id']
placeholder = existing_attribute['placeholder'] if 'placeholder' in existing_attribute else None
is_mandatory = existing_attribute['is_mandatory'] if 'is_mandatory' in existing_attribute else False
expense_field = platform.expense_custom_fields.get_by_id(custom_field_id)
fyle_expense_custom_field_options = expense_field['options']
last_imported_at = expense_field['updated_at']
Expand Down Expand Up @@ -972,7 +974,7 @@ def create_fyle_expense_custom_field_payload(
'field_name': fyle_attribute,
'type': 'SELECT',
'is_enabled': True,
'is_mandatory': False,
'is_mandatory': is_mandatory ,
'placeholder': new_placeholder,
'options': fyle_expense_custom_field_options,
'code': None
Expand Down

0 comments on commit d5e84c6

Please sign in to comment.