mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 08:24:47 +00:00
fix: sales_tax attribute in api call before submit
This commit is contained in:
@@ -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])
|
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:
|
if from_shipping_state not in SUPPORTED_STATE_CODES:
|
||||||
from_shipping_state = get_state_code(from_address, 'Company')
|
from_shipping_state = get_state_code(from_address, 'Company')
|
||||||
@@ -139,14 +139,21 @@ def get_state_code(address, location):
|
|||||||
|
|
||||||
return state_code
|
return state_code
|
||||||
|
|
||||||
def get_line_item_dict(item):
|
def get_line_item_dict(item, docstatus):
|
||||||
return dict(
|
tax_dict = dict(
|
||||||
id = item.get('idx'),
|
id = item.get('idx'),
|
||||||
quantity = item.get('qty'),
|
quantity = item.get('qty'),
|
||||||
unit_price = item.get('rate'),
|
unit_price = item.get('rate'),
|
||||||
product_tax_code = item.get('product_tax_category')
|
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):
|
def set_sales_tax(doc, method):
|
||||||
if not TAXJAR_CALCULATE_TAX:
|
if not TAXJAR_CALCULATE_TAX:
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user