When creating a Sales Order from the REST API, it seems taxes are not applied.
As far as I can see, at least for Shipping Rules, it seems it is javascript that triggers recalculation.
It looks like VAT isn’t computed neither.
Any update on the topic? I think it’s mandatory it is either calculated server side when the document is saved or we have access to a method to call using the REST API.
How can i pass them ? i need to create them from the Taxes And Charges Template ? is there a function (like in the client side) that is doing this in server side ? i tried to use taxes_and_totals controller from erpnext.controllers.taxes_and_totals but without success
I didn’t find any solution throw the API i have written a function to fetch the taxe items but it will help you only if you have your custom frappe app
def _set_sales_taxes_and_charges(sales_order):
if not sales_order.taxes_and_charges:
return
taxes_and_charges_template = frappe.get_doc('Sales Taxes and Charges Template', sales_order.taxes_and_charges)
# taxes = []
tax_fields = [
"charge_type",
"account_head",
"description",
"cost_center",
"rate",
"row_id",
"idx",
]
for tax in taxes_and_charges_template.taxes:
sales_order_tax_dict = sales_order.append('taxes', {})
for field_name in tax_fields:
sales_order_tax_dict.set(field_name, tax.get(field_name))