Writing an app: doctype customization and logic overriding?


We’re a micro-brewery in France and I’m currently writing an app for ERPNext to handle our business logic.
I’ve followed the tutorials and managed to create an app and a standard report, that was quite cool :slight_smile:

Now, I have a few questions on how I should go on:

  • I’d like to create the notion of Fermenter Tank (a tank where you store young beer for a few days/weeks while the yeasts work) while keeping the existing Warehouse logic. So, basically, a Fermenter Tank is another Warehouse with a few more fields (such as capacity, shape for e.g.). Since I have other warehouses that do not need these special fields, how should I handle that? I see two ways:
  1. Add specific fields to the Warehouse DocType and only use them when necessary
  2. Create another DocType called Fermenter Tank and make a link to a Warehouse

I feel more comfortable with the second option but if I do, I won’t be able to use all the existing logic tied to the warehouses.

  • My second question is about reusing and overriding some logic. Let’s keep this same example, with Production Planning. When you produce beer, you want to allocate a Fermenter Tank based on your Batch volume. So, if I brew 200L, then I need to allocate a Fermenter Tank of at least 200L. How would I implement that without having to rewrite all the planning logic?

Thanks for your answers,


@glibersat, you are in Manufacturing Flow, so Ferment Tank is a Workstation.

Workstations works like temporary Warehouses were you can control how many of materials you have, and how much time, it will keep in each Workstation.

I believe that you need get a look into the manufacturing flow, it have all pieces that you need! And it will decrese your development time, using the right pieces.

The second question, is solved about how much litters you will produce in each order.

If you have a receipt to produce 1, 10 or 100 litters of beer, you can make a BOM (Bill of Material) to issue production orders.

1 Like

Hi @max_morais_dmm, thanks for your answers, I will investigate this and get back here if I don’t find answers in the manufacturing flow code!


1 Like

I tried to modelize my workflow and I’m almost done. I have a few questions tho:

  • How do you make the system create cascaded Production Orders ? (Beer is made of [Green Beer that is made of [Wort]]). So I would expect 3 Production Orders here but ERPNext only creates the latest one (Beer). Any way to trigger that?

  • I need to have the same batch number for different items (Beer #02Green Beer #02Wort #02. Any way to keep it along the production?

  • Is there a way to schedule production orders so they follow each others when one requires another one?

  • Now, if I want to make a Brewing app that reuse the production logic, is there a reference somewhere explaining how to reuse the logic in another doctype/page?

Thanks again for your awesome support!


Think that each step is a product, so you can create a bom for Worth, worth is used in Green and Green in :beer:, when do you run a production planing, for make some beers, it will evaluate how much units do you have of everything, if it’s not enough we will return back to reorder flow, but in that case, the flow is for manufacturing.

Check ERPNext documentation, specially about stock and manufacturing


I’ve already read the user, developer and tutorial manuals a few times but couldn’t find an answer.

This is what I already had:

then I have my operation there:

My BOM for the Dry Hopped Beer (almost final beer) is made of the other ones:

When I ask for 75liters of Dry Hopped Beer using a PO, then here’s what I get:

If I check ‘muti level BOM’, then when transferring material, all the raw materials are indeed fetched BUT only one operation is made (Dry Hopping and not Brewing nor Fermenting) :

If I uncheck ‘multi level BOM’, then when transferring material, Green Beer is requested but since there’s none in stock, it won’t allow a Material Transfer for Manufacturing AND previous Operations are note created:

So, how can I make it create all operations ? I.e. Brewing, Fermentation and Dry Hopping just by required the latest one ? I mean, if I make a PO for 75 litres of Dry Hopped Beer, I should get also a PO for 75 litres of Green Beer and another one of 75 liters of Brewed Beer. All of them should be assigned a date so they follow a sequence.

I hope this clarify the situation, thanks!

@glibersat, you need a multilevel BOM, because, it’s based in various process!

It’s correct, if you dont raise a multi-level BOM, ERPNext assume that you already have all requirements in Stock.

@glibersat, that is the purpose of “Producion Planning Tool” it should raise all operations considering the hierarchy, if it’s not ocurring, maybe you found a issue :slight_smile: