Conditional BOM Items and Order Workflow


An evaluation of ERPnext shows promise for our requirements. However we have some complex online products (‘make to stock’ items) that are made up of different combinations of stock items and attributes and therefore have a couple of questions:

Question 1

Is it possible to create BOMs that have conditionally allocated stock items, depending upon:

  1. an attribute of the order

  2. stock levels of BOM items?

For example:

Order received online for -> MAIN BOM ITEM

-> BOM ITEM A (stock item, must always be part of order)

-> BOM ITEM B (non-stock item, must always be part of order)

-> BOM ITEM C (stock item, preferred if stock available)

-> BOM ITEM D (stock item, if no stock of C)

-> BOM ITEM E (added depending on an order attribute)

I understand that attribute variations (i.e the conditional addition of BOM ITEM E) may not be possible and therefore require a BOM for every variation, but a fall-back item (i.e. BOM ITEM D) if no stock of preferred item © seems to be missing and can’t see how this would work.

Question 2

Is it possible that orders can be ‘workflowed’? The ‘HR’ workflow example of leave request and approval is OK, but it doesn’t cover the possibility of an ‘automated’ workflow. Due to the quantity of online orders we process, it’s neither practically or economically possible to manually intervene.

Thanks in advance.

Part 1: This is a customization. You will need to hook the validate event on Sales Order and execute a script that will check the condition.

Part 2: You can add workflows to any document.

rmehta, thank you for your reply. I think that I have a similar issue and I am not sure whether it would have the same solution. I am also in the same boat - new to ERPNext and setting up my business in the system.

Consider the following scenario - I sell jars of candy. The amount of candy in the jar can vary from 10 to 100 and is defined by the customer at order time. Is there a simple way to set this up, without customization? Or does it require the same solution as above?

Thank you!


You can create a Sales BOM for each type of Candy Jar