Hello everyone,
I’ve set up item-wise taxation, but when posting a sales order via the REST API, the item-wise tax doesn’t calculate automatically. Is there a way to resolve this?
Please guide me.
Hello everyone,
I’ve set up item-wise taxation, but when posting a sales order via the REST API, the item-wise tax doesn’t calculate automatically. Is there a way to resolve this?
Please guide me.
yes, i facing same issue…any way for this?
may be this issue occur because taxes and change child table change based on item_code in items table, this code created js and when you call api this run py code so, item tax not getting properly as my knowledge Please correct me if i am wrong
Hello,
I have found a solution to add taxes and charges while creating a Sales Order using the API. I utilized the default function for adding taxes and integrated it into the doc
events in hooks.py
.
from erpnext.controllers.taxes_and_totals import calculate_taxes_and_totals
import frappe
from erpnext.controllers.accounts_controller import (
AccountsController,
get_taxes_and_charges,
)
def sales_order_set_taxes_and_totals(doc, events):
taxes_and_charges = get_taxes_and_charges(
master_doctype="Sales Taxes and Charges Template",
master_name=doc.taxes_and_charges,
)
if taxes_and_charges:
for row in taxes_and_charges:
doc.append("taxes", row)
doc.save()
frappe.db.commit()
hooks.py
doc_events = {
"Sales Order": {
"validate": "custom_app.api.accounts_controller.sales_order_set_taxes_and_totals",
}
}