[Feature] Allow Rate in Transactions to be based on Stock UOM

Hi everyone,
I’m working on a (small) new feature that allows item rates to be based on stock UOM instead of the transaction UOM.

The background is that my company is a hotel/restaurant and we therefore mainly buy food. As food is not as easy to quantify as standardised products, it is sometimes cumbersome to enter the prices in purchase invoices and receipts.
We order many food products in Nos, but they are often invoiced in kg. ERPNext does not allow to change the UOMs within the purchase process (which is a good thing), but a higher flexibility in terms of amount calculation would be helpful.

I thought of adding a checkbox to Purchase Order Item, Purchase Receipt Item and Purchase Invoice Item (and respectively for the Sales Items as well), which changes the calculation of the item’s amount from

rate * qty = amount

to

rate * stock_qty = amount

Please let me know what you think of this idea. I checked if this breaks item valuation or price list fetching but couldn’t find any issues, but maybe I missed something.
Maybe one of the devs can point out potential issues with this.

My developing branch can be found here: https://github.com/P-Froggy/erpnext/tree/feat-price-based-on-stock-uom-develop

How about another approach. You have two custom fields: One where the user inputs the rate in the Stock UOM. The other custom field is read only and that displays the rate that the user needs to input into the standard rate field in the UOM of the transaction. And the formula to calculate the StockUOMRate*ConversionFactor.

This way you don’t mess up the standard ERPNext flow. Of course it means that your user has to enter the rate twice - The stock UOM rate the Custom Field the result of that into the standard rate field. If you can figure out a way to auto populate that into the rate field, you have one entry less, but I don’t think ERPNext let’s you write values into fields that are user inputs.

Hope this helps.

Thanks

Jay

1 Like