Tried importing some sales invoices with data import tool. The system correctly set the item tax template and tax category. But the tax table is empty and the total taxes and charges remains 0.
Tried setting a hook on Sales Invoice validate to run calculate_taxes_and_totals()
but hooks aren’t triggered on import.
Any way I can achieve the same?
Were you able to fix this? Workaround is to calculate and include taxes in the upload file, which I really don’t want to do
Couldn’t get it to work, although if you add the account heads of tax table in the rows, system will automatically calculate the tax amount.
So, using the following links, it should be possible:
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",…
and this:
are you trying to customize it? If you want to do some additional function on submit of delivery note use hook for it from your app
Check - Hooks
e.g. In your apps hooks.py add this.The function on given path get called while submitting of a delivery note
doc_events = {
"Delivery Note": {
"on_submit": "{dotted.path.to.function}",
}
}
it should be possible to calculate the sales/purchase tax using the before_submit event. It will have to be a custom app
Let me experiment this week.
Yeah, this can be possible. Import it all in draft mode and run a script to set the tax heads.
Am able to do this for some limited use cases now. I haven’t covered all of the Sales/Purchase Invoice use cases, however.
Created a ‘hook’ on the ‘before_submit’ event.
It will calculate taxes whenever you submit an invoice - if the ‘taxes and charges’ section is empty.
I am using tax rules to get the tax details. So, if you want to use the tweak, you will have to define tax rules.