Warehouse required for a bundle

I created a new bundle named ’ SAC0044 New Bundle’ and this is not a stock item. So ‘maintain stock’ is unchecked. Added two regular items to the bundle and both of the items had their warehouse set and there was a stock balance of 10 for each item in their warehouse.

Created a sales order adding 2 quantity of ‘SAC0044 New Bundle’. When I try to save the sales order it says ‘Delivery warehouse required for stock item SAC0044 New Bundle’.

This looks like a bug to me since bundle should not be a stock item.

Is there a fix for this?



Is Warehouse set in both the stock items same?

Though Product Bundle is not a stock item, you will have to select Warehouse for it in transaction. This is proabably because in the Item master, Warehouse is not a mandatory field. Hence you might have stock items for which Warehouse is not defined.

For suggestion for fetching warehouse in stock item from respective item masters, please create Github Issue.

How do I select the warehouse in transaction? I couldn’t find a way to do this in sales order.

Both items under in the bundle has same warehouse set and they do have stock in the warehouse too.

I was able to fix this by playing a trick but it is not the right way of doing it. Therefore, a fix is needed in ERPNext.

What I did to fix this issue?

  • Edit the bundle and make it a stock item.
  • Set the warehouse for it and save the bundle.
  • Edit the bundle again and just un-tick ‘maintain stock’
  • Save the bundle.

After above workaround is done, I can save the sales order without an issue.

This is a bug in ERPNext.

Found the piece of code this is validated. I am not a Python developer so can someone help me fix this issue for my instance?

erpnext/sales_order.py at develop · frappe/erpnext · GitHub
Line 116 to 124.

def validate_warehouse(self):
super(SalesOrder, self).validate_warehouse()

	for d in self.get("items"):
		if (frappe.db.get_value("Item", d.item_code, "is_stock_item")==1 or
			(self.has_product_bundle(d.item_code) and self.product_bundle_has_stock_item(d.item_code))) \
			and not d.warehouse and not cint(d.delivered_by_supplier):
			frappe.throw(_("Delivery warehouse required for stock item {0}").format(d.item_code),

I agree, in my particular case, I opted for direct modification of the actual Bundle Item in the tabItem table, by directly inserting into defalut_warehouse the correct warehouse, and the problem was solved.

However this should be automatically validated in “non-stock” items when the default warehouse is updated in Stock Settings. I will setup an issue on GitHub for this.