Negative stock for specific item group


Is it possible to allow Negative Stock only for specific Item Group in erpnext?

This feature is not available currently

Why you are looking for this feature?

Maybe because you have a set of products that are always in stock because you purchase them from wholesalers and keep inventory.

And then you may also have a group pf products that you also want to sell to your clients that has a short expiration date, so you do not want toe keep them in inventory and you only want to buy them as they are sold.

By being able to have the in-stock items only available if they are in stock and the short expiry products available on demand you need to be able to have each group act differently in the sales module.

Wonderful idea, but just not available yet.


1 Like

Ok, You can add this feature:

  1. Add new checkbox field in “Item Group” Doctype with name “allow_negative_stock”

  2. Add this line in erpnext/stock/doctype/stock_entry/ like that:

    def set_actual_qty(self):
    allow_negative_stock = cint(frappe.db.get_value(“Stock Settings”, None, “allow_negative_stock”))

     for d in self.get('items'):
     	allow_negative_stock = cint(frappe.db.get_value("Stock Settings", None, "allow_negative_stock")) or cint(frappe.db.get_value("Item Group", d.item_group, "allow_negative_stock"))
     	previous_sle = get_previous_sle({
     		"item_code": d.item_code,
     		"warehouse": d.s_warehouse or d.t_warehouse,
     		"posting_date": self.posting_date,
     		"posting_time": self.posting_time

Hi tazi,

with respect to your thread, does ERPNext make provision to give negative_stock_access to a user to go over available stock, if not can you please help with that, this is an urgent requirment for me. Please anyone else can also help, thanks