On save, Purchase Invoice adds a fictitious Purchase Tax. How to stop it?

We have a Tax Rule that filters on Tax Category “RIMPE” so as to provide Purchase Tax Template “RIMPE - LSSA” which specifies a single On Net Total tax to post to accounting rubric “2.1.3.02 - Impuesto IVA Por Pagar - LSSA”.

This configuration works correctly for the Purchase Order

… but when a Purchase Invoice is created from the Purchase Order

… an entirely invalid additional tax gets added.

All of our Chart of Accounts item names begin with a consistent numerical hierarchy, so that non-numbered account VAT - LSSA obviously does not belong there. Worryingly, I do not know when or how it crept into the Chart of Accounts. Clearly, it is a hangover artefact from the original installation.

There seems to be a default operation that invokes that ERPNext default Value Added Tax, so I would like to ask:

  1. Is there an ERPNext setting for Purchase Invoices, which invokes a Valued Added Tax charge that I could disable?

  2. Our General Ledger shows one single invoice connected to that spurious rubric VAT - LSSA. It is blocking me from deleting VAT - LSSA from the Chart of Accounts. Does there exist a way to remove the invoice from the ledger, so as to be able to delete the VAT - LSSA rubric from the Chart of Accounts once and for all?

Hello @MartinHBramwell,
we have a same issue with these: SO → SI, SO → DN, PO → PI.
When the items have a “Item tax template” then the “fetched doc” (SI, DN, PI) has a additional invalid tax.

For a while we are using this “bypass” client script for correcting (PI for example):


frappe.ui.form.on('Purchase Invoice', {
	onload_post_render(frm) {
		if (frm.is_new()){
		    frm.doc.taxes = [];
		    let template = frm.doc.taxes_and_charges;
		    frm.set_value('taxes_and_charges');
		    frm.set_value('taxes_and_charges',template);
		}
	}
});

This code clear all taxes, clear the tax template and set this tax template again, if the form si new.
The refetching of tax template will set right taxes.
Did you make a issue on erpnext github, please?

Thank you.
Jiri Sir

I seem to have stopped the issue from occurring.
Unfortunately I cannot state which change I made that actually solved it.
Mostly these were brute force changes using SQL in the database.

I did notice that the spurious line came from a disabled, but still existing, Purchase Taxes and Charges Template. It was not possible to remove it, because it was connected to existing POs, PIs, and PRs. Fortunately there were only a very few of those connections.

  1. Beginning with PRs, then the PIs and finally the POs, I NULLed the field in each of the guilty documents:
update `tabPurchase Receipt` set taxes_and_charges = NULL where name =  "MAT-PRE-2024-00013";
update `tabPurchase Receipt` set taxes_and_charges = NULL where name =  "MAT-PRE-2022-00010";
  1. I made sure that every single supplier has an explicit Tax Category… No NULL values. No “” values.

To check them all I used…

SELECT
        name
      , purchase_taxes_and_charges_template as ptct
      , tax_category
      , supplier_group
FROM `tabSupplier`
WHERE name like "%"

With all connections eliminated, I was able to extinguish the spurious Purchase Taxes and Charges Template

After that, the problem did not recur.

I believe ERPNext hunts for appropriate default values where users have not been explicit about things. So, my exercise was to eliminate all ambiguity about Purchase Taxes and Charges Template by using an explicit Tax Rule referring to an explicit Tax Category for every Supplier

Finally, we have checked option “ Automatically Add Taxes and Charges from Item Tax Template” in account settings.
After unchecking the our “issue” is gone :slightly_smiling_face:
Jiri Sir

1 Like