This is a question concerning domains where people specify the quantity by piece when selling or buying an item. However, the money amount is to be computed according to the “size” of the item, not only the count.

For example, let our item be a “bag of salt” which by spec contains a constant amount, 3.21 Kg of salt. And let the price be 10 dollars per Kg. When entering a Purchase Order, it is desirable that the user enters the number of bags, rather than the number of Kgs. So the user for example would enter 2 bags (rather than 6.42 Kg). In this case, if the price per Kg is 10 dollars, I would like the Purchase Order DocType to compute the dollar amount as 2x3.21x10 = 64.20 dollars.

I know we can do it such that the user enters 6.42 Kg as the quantity, but that is very unnatural. The natural conduct as humans is to enter 2 bags, and then the system would do the calculations: Money Amount = number of bags times how many Kgs in a bag times the price per Kg. In theory, this should be possible if we can just make the system aware that a bag contains how many Kgs.

I hope the above can be done in ERPNext? I could not find the way myself and would appreciate any help.

@almuallim you can do that . in the item you specify that the uom is kg . then mention the price of 1kg in the price list . now scroll down in the item itself to the uom table , here you can enter different uom such as bag . you specify how many kg is a bag in the conversion factor . now whenever you buy or sell you can chose to buy 2 bags and the system will do the math for you .

Thank you for your replies.
In both replies from @umarless and @bahaou, the user has to manually calculate the price of a bag and enter it. This is exactly what we need to AVOID. What I have given is just a simple example for illustration. You simply propose that the user manually multiplies the price of kg by the weight and enter that as the price of a bag. However, we have many items and each item has its own weight, and we are working in a market where deals are all negotiated based on the price of Kg. It would be tedious to keep calculating manually the price of a bag just to use ERPNext as it exists. The most natural approach is to somehow give the system the weight of the bag, the price of a Kg and the number of bags and the system does: Price = #bags X kg per bag X rate per Kg. No manual work on the user part–that what makes most sense. Any ideas? I believe this requires customization of the existing ERPNext?
Thanks again.

@almuallim I did not enter the price of the bag manually . I set the price of 1kg which is 10 then the system will automatically set the price of the bag. The most natural approach is to somehow give the system the weight of the bag ->you can do this in the item page . please understand that ha you are asking for exists in the system .