Good morning all,
Here is the scenario.
I am buying these products as per Purchase Receipt.
The price on the PR is VAT inclusive so I ticked that box on the Taxes and Charges template.
Now the accounting ledger of that transaction one submitted is very very weird
Note I have just renamed the account “received but not billed” to “GRN accruals” which is the proper accounting term for it.
So there is the first error. I really have no idea why that debit on the GRN accruals and where it is coming from?
The proper entry should have been Main (stock asset) debited by 1,008.62 and and GRN accruals credited by same amount.
Where is that 317.37 coming from? and where is that 1325.99 coming from? The total invoice, vat included is only 1170!!
Then I create the purchase invoice.
And the accounting ledger there is done properly
So now obviously my GRN accruals will not be 0 anymore.
What is going on? And how can the system allows such entries?
Now even more concerning and weirder.
I am doing the exact same transaction on an other instance of ERPNext and I get different results.
See for yourself.
See the accounting entries for that purchase receipt
See the purchase invoice for that entry.
What is going on? After a purchase cycle (Purchase receipt + purchase invoice) the account "stock received but not billed - in my case “GRN accruals”) should simply be 0.
It is the exact same entries with the same parameters but ERP is passing different entries on the background, that is just not ok!!!
I can replicate the issue in demo account. Will push fix as soon as possible.
The issue is due to negative inventory. The fact is that when inventory goes into negative, system does not know the correct valuation rate for outgoing entry. The system just try to predict the outgoing rate based on previous valuation rate and books accounting entry based on that.
We strongly recommend to disable negative inventory if you want to activate perpetual inventory. Because accounting entry can go wrong if negative inventory is enabled. This problem is there in all other systems, whether it is SAP or Quickbooks, because you actually don’t know the rate in case of negative inventory.
In this case, system is getting negative stock value difference, which is creating problem. There is an error in valuation rate calculation in case of negative inventory, I have fixed that. I have changed the calculation login and followed the procedure used by SAP.
Basically when stock remains in negative side, the valuation rate gets frozen and it remains the same valuation rate as last transaction in the positive side. And when it becomes from negative to positive, system takes the incoming rate of that entry as valuation rate. So, you can understand, while stock remains in negative, stock value difference due to the entry does not match with the transaction values.
I have written a patch to repost the valuation rate as per the new logic in case of negative stock. Please pull the fix and check amending the Purchase Receipt if it improves the accounting entry.