Skip to content

Commit

Permalink
fix: sales_tax attribute in api call before submit
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesis189 committed Sep 14, 2021
1 parent 39fbfcb commit 7ddc460
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions erpnext/erpnext_integrations/taxjar_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def get_tax_data(doc):

shipping = sum([tax.tax_amount for tax in doc.taxes if tax.account_head == SHIP_ACCOUNT_HEAD])

line_items = [get_line_item_dict(item) for item in doc.items]
line_items = [get_line_item_dict(item,doc.docstatus) for item in doc.items]

if from_shipping_state not in SUPPORTED_STATE_CODES:
from_shipping_state = get_state_code(from_address, 'Company')
Expand Down Expand Up @@ -139,14 +139,21 @@ def get_state_code(address, location):

return state_code

def get_line_item_dict(item):
return dict(
def get_line_item_dict(item, docstatus):
tax_dict = dict(
id = item.get('idx'),
quantity = item.get('qty'),
unit_price = item.get('rate'),
product_tax_code = item.get('product_tax_category')
)

if docstatus == 1:
tax_dict.update({
'sales_tax':item.get('tax_collectable')
})

return tax_dict

def set_sales_tax(doc, method):
if not TAXJAR_CALCULATE_TAX:
return
Expand Down

0 comments on commit 7ddc460

Please sign in to comment.