Skip to content

Commit

Permalink
bug fix: check for RateValue key in tax rate dict (#585)
Browse files Browse the repository at this point in the history
  • Loading branch information
NileshPant1999 authored Mar 20, 2024
1 parent ff4ab83 commit 48554d6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions apps/quickbooks_online/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,13 @@ def get_effective_tax_rates(self, tax_rates):
effective_tax_rate = 0
tax_rate_refs = []
for tax_rate in tax_rates:
tax_rate_refs.append(tax_rate['TaxRateRef'])
tax_rate_id = tax_rate['TaxRateRef']['value']
effective_tax_rate += self.connection.tax_rates.get_by_id(tax_rate_id)['RateValue']
if 'TaxRateRef' in tax_rate:
tax_rate_refs.append(tax_rate['TaxRateRef'])
tax_rate_id = tax_rate['TaxRateRef']['value']
tax_rate_by_id = self.connection.tax_rates.get_by_id(tax_rate_id)

if 'RateValue' in tax_rate_by_id:
effective_tax_rate += tax_rate_by_id['RateValue']

return effective_tax_rate, tax_rate_refs

Expand Down

0 comments on commit 48554d6

Please sign in to comment.