Batchwise pricing of items

Hi, can someone point me towards how to enable batch wise pricing for items. Basically in Pharmaceuticals, different batches for same items have different prices.

Essentially I want that when i sell an item, it picks up prices of that particular batch and not the item price.

I’ve looked at the batchwise inventory management, but that doesn’t have prices.

I think that i have to edit the file in “stock”. but i dont know how to handle pricelists, somehow link batch, and make pricelist batchwise instead of item wise.

any suggestions?

@Sagun_Sood for now, ERPNext does not support Batchwuse pricing of Items.

I think you should raise one issue on github

Im trying to customise the software for batchwise pricing and im a little stuck, can anyone help me out.

  1. I added a field in Item Price Doctype, called batch_id which is linked to Batch doctype.
  2. I added validation in as follows

def check_duplicates(self):
conditions = “where item_code=%(item_code)s and price_list=%(price_list)s and batch_id=%(batch_id)s and name != %(name)s”

	for field in ['uom', 'valid_from',
		'valid_upto', 'packing_unit', 'customer', 'supplier']:
		if self.get(field):
			conditions += " and {0} = %({1})s".format(field, field)

	price_list_rate = frappe.db.sql("""
		SELECT price_list_rate
		FROM `tabItem Price`
		  {conditions} """.format(conditions=conditions), self.as_dict())

	if price_list_rate :
		frappe.throw(_("Item Price appears multiple times based on Price List, Supplier/Customer, Currency, Item, UOM, Qty and Dates."), ItemPriceDuplicateItem)
  1. Now I am trying to edit the get_item_price function in (in “stock” folder) to automatically get price based on batch number and i am unable to do so.

any advice?


I think the simplest thing for you to do would be to add a custom field in the Batch DocType and plug in the Price for the Batch into this currency field. Then with some scripting, you’d be able to fetch the price automatically every time you make a Delivery Note or an Invoice cum Delivery Note.

Hope this helps.



the app pos bahrain by @fkardame and team has achieved this. Search for it on github


Hi sir,
I am doing the same thing I need to fetch the Item price in the batch and i able to do that but how can i fetch the same rate in delivery note item with same batch