I think ERPNext will benefit greatly from using an exact cost valuation method.
Here is how I think it should work, please add your thoughts
All items receipted will have an auto generated number to keep track of the cost - current batch number can be used for this or we can add a new one, or for purposes here we will call it ‘lot’. An Item can appear more then once in the document lines and can have a different cost which will in turn get a different lot number when processed.
All movement of the stock item, delivery, returns etc, should use this lot cost. So when a user delivers an item they are meant to pick the lot from which they want to deliver the stock. We could have a setting that says ‘FIFO’ for picking the lot - but this is different from the current FIFO for stock valuation. Multiple lots should be allowed per document line. So if we require 3 items we should be able to pick from seperate lots to make up the 3 required, 2+1, 1+1+1, etc.
Which lot to pick is determined by the project and sales orders generated when creating the sale. Procurement happens after and usually we procure only on customer order. Managing costs in this way will also help calculate commissions more accurately or GP on and invoice which can then be displayed on the invoice instead of a report.
The cost posted in the journals are the sum of the lots used in the document line. I also believe that if we want to achieve the GP view on invoice it would be better to post the ‘cost of sales’ at the point of invoicing and rather accrure the cost on delivery - just like how when a receipt is done there is a ‘Stock Received But Not Billed’ there should be a ‘Stock Delivered But Not Billed’ account on a delivery note.
Different types of valuation can exists in the system but for accuracy I think that once ‘Lot’ costing is set for an item or in the sytem then there should not be any change of valuation method.
this method also allows items to be receipted that have no cost - demo or zero valued items received from supplier.
I think this covers most of it but please lets debate this incase I missed anything.