Stock difference account posting after change in inventory valuation

Hello Everyone.
A quick question regarding postings made to the stock difference account.

While in the approval process of a Stock Entry document, should a change in the valuation rate of the outgoing(consumed) items trigger a posting to be made to the stock difference account?

Scenario below

Stock Entry for Manufacture (Draft) - Valuation rate of an item $10

Purchase receipt is booked ( Valuation rate of item in warehouse drops to $4)

Stock Entry
stock entry for Manufacture is submitted

ERPNext uses the adjusted valuation rate for consumed items and does not add this change in stock value to the value of the produced item.
Instead, the difference is posted as a credit on the stock difference account.

Any ideas why this is happening?

Hi Joseph,

ERPNext fetch the valuation rate upon the creation of Stock Entry. However upon submission, it fetch the current valuation rate again.

This is same situation with payment of invoices where the validation only happened upon creation.

I am not sure whether this already reported before, but I add some validation for those issues.

  • Validation to inform user if the entered basic rate has been overwritten by system
  • Validation to prevent negative outstanding invoice

Regards,
Subhajit

1 Like

Thanks for your reply.
I believe the total cost of the incoming product should change as well, because the cost of the items that produced it have increased.

@SubhajitDey @JayRam Hello, I have noticed that if the valuation rate of raw materials change between the period where a Stock Entry document is created and when it is submitted, the value of the produced item (Total Incoming Value) does not change accordingly. Rather, it always remains at the value when the stock entry was first created.

This seems to be the reason why the finished item value is calculated only once, Changing the update_finished_item_rate flag to True will force ERPNext to recalculate the finished item’s value.

Is this by design ? I believe that on submission of the stock entry,the value of the produced item should be updated so that it is equal to the value of the raw material at the time of submission.

What could be the reason for the way that ERPNext handles this?

Hi Ebuka,

Would you please post the transactions hiding sensitive information in those transactions.

I am reasonably certain ERPNext is working predictably as designed. You just need to figure out why you are getting results that are unexpected.

ERPNext maintains warehouse level valuations. Then you have have the mode of valuation - Moving Average or FIFO.

Please post, if you can, the stock ledger output for the warehouses where you have trouble.

Thanks

Jay

Thanks Jay,

First, I created a stock entry from a work order. so the stock entry had the following values when saved.

So while the stock entry from manufacture was in draft,see the stock ledger of an Item in the warehouse showing the current valuation rate.

Next, a new stock entry was submitted that increased the value of the item in that same warehouse, the stock ledger represents this transaction as follows.

Submitting the initial stock entry for manufacture shows that the new value of the raw materials is indicated on the stock entry while this increment did not affect the value of the Item produced

I am trying to understand the reason behind this behavior, from what I saw from the code, It was consciously set that way.

Hi Ebuka,

It’s very difficult for me to follow the transactions as I cannot see the Item Code or the Transaction type that resulted in that entry, Ebuka. However, I will still go ahead and guess. For the manufactured/transformed Item, please check if you have a Valuation Rate in the Item Master. Or check if you have FIFO turned on for valuation either at the global level. Or at the Item Level.

Hope this helps.

Thanks

Jay

Apologies for being unclear and thanks for your help.

First, let me state some ideas that guide my reasoning for an inventory system running on Moving Average valuation method.

  • Cost of raw materials should flow directly into the finished products, ie if the total raw material value is 25USD then the cost of the finished item should also be 25USD.

  • If the value of any raw material changes within the period between a document’s creation and submission, the value of the manufactured material should adjust to accommodate the difference.

I created a stock entry with entry type Manufacture from a work order, in this work order, I skipped material transfer to warehouse because a different stock entry document has done that already.
the document is saved and goes into workflow for the final approval


Notice the value of the incoming and the outgoing items.

And the Stock ledger of Sugar (one of the raw materials) showing the valuation rate in that warehouse while the document is in draft.

After this, a new batch of sugar are received into that warehouse either through a Delivery Note or Stock Entry, this new batch will increases the valuation rate of the item, just as indicated in the screenshot.

Going back to submit the first stock entry that was created from the work order, indicates that the system has recalculated the value of the raw materials as outgoing value but has not calculated the value of the produced material.
This difference is posted to the stock adjustment account.

It is noteworthy to say that all subsequent stock entries created from the same work order use the updated item values for incoming and outgoing

I think this is a more of an “Is this meant to work this way?” kind of question.

Thanks.

No it’s not. At least it shouldn’t be. I think there is a refresh issue someplace. Rather than a workflow (which might force the values in the transaction to be the same), consider a simple “workflow”. Give one role the ability to not submit a Stock Entry purpose Manufacture (or whatever entry you are using for the manufacture entry) and another role the ability to Submit the Document. So the creator of the document assigns it to the user that has to role to submit the Stock Entry Purpose: Manufacture. Maybe in this type of a scenario the valuation rates may get updated. If it still doesnt, the Submitter may have to hit Get Materials (or choose the Manufacture Item again) and the valuation rate may get updated.

But on another note: Is Nigeria witnessing such serious inflation? Like Sugar in one consignment is 150 and the next is 150,000. A thousand fold increase!! Or are you just stress testing the system? :slight_smile:

Hope this helps.

Thanks

Jay

Okay, Thanks for your input in this again.

No, Nigeria is not experiencing these levels of inflation, This was something I noticed while debugging an issue caused by a client mistakenly entering a wrong figure in a purchase order, this led to the spike in inventory value.

@Ebuka_Joseph_Akeru this seems like a bug to me. Perhaps you should convert this to an issue against ERPNext v12 in github. You might have to use a hook to correct the code that is causing the incoming value not to be recalculated.