Skip to content

Commit

Permalink
fix: update tax rounding difference in the last item
Browse files Browse the repository at this point in the history
  • Loading branch information
vorasmit committed May 8, 2024
1 parent 204afed commit ddc8d14
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions india_compliance/gst_india/overrides/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,8 @@ def set_item_wise_tax_details(self):

old = json.loads(row.item_wise_tax_detail)

tax_difference = row.tax_amount

# update item taxes
for item_name in old:
if item_name not in tax_details:
Expand All @@ -1051,13 +1053,19 @@ def set_item_wise_tax_details(self):
item_taxes = tax_details[item_name]
tax_rate, tax_amount = old[item_name]

tax_difference -= tax_amount

# cases when charge type == "Actual"
if tax_amount and not tax_rate:
continue

item_taxes[tax_rate_field] = tax_rate
item_taxes[tax_amount_field] += tax_amount

# Handle rounding errors
if tax_difference:
item_taxes[tax_amount_field] += tax_difference

self.item_tax_details = tax_details

def update_item_tax_details(self):
Expand Down

0 comments on commit ddc8d14

Please sign in to comment.