Skip to content

Commit

Permalink
Handle tax items sync safely (#555)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin1111 authored Apr 30, 2024
1 parent f04c3f8 commit f7ccd0b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/netsuite/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,9 @@ def sync_tax_items(self):
if not tax_item['isInactive'] and tax_item['name'] and tax_item['taxType'] and tax_rate:
value = self.get_tax_code_name(tax_item['name'], tax_item['taxType']['name'], tax_rate)

tax_item_attributes.append(self.get_tax_item_attributes(tax_rate, tax_item, value, True))
destination_attribute = self.get_tax_item_attributes(tax_rate, tax_item, value, True)
if destination_attribute:
tax_item_attributes.append(destination_attribute)

DestinationAttribute.bulk_create_or_update_destination_attributes(
tax_item_attributes, 'TAX_ITEM', self.workspace_id, True)
Expand All @@ -927,7 +929,9 @@ def sync_tax_items(self):
tax_rate = float(tax_item['rate'].replace('%', ''))
value = self.get_tax_code_name(tax_item['itemId'], tax_item['taxType']['name'], tax_rate)

tax_item_attributes.append(self.get_tax_item_attributes(tax_rate, tax_item, value))
destination_attribute = self.get_tax_item_attributes(tax_rate, tax_item, value)
if destination_attribute:
tax_item_attributes.append(destination_attribute)

DestinationAttribute.bulk_create_or_update_destination_attributes(
tax_item_attributes, 'TAX_ITEM', self.workspace_id, True)
Expand Down

0 comments on commit f7ccd0b

Please sign in to comment.