Production order to depend on Newly created DocType

I have created a DocType “Cycle” as shown in picture.

All production orders will be linked to this documen.
How do I achieve my production order to depend on this document as not to exceed the qty of production order than cycle qty.

I know the logic as follows

 if production order qty > cycle qty
 print ("Check for qty")
 else if (Cycle status=stop)
 print ("Cycle is stoped")
 else if production order<=cycle qty & to be produced qty for sales order <= sales order qty
 serial no=serial no+1
 sales order qty
 allow for creation

I am thankful for help.

Kindly ignore “sales order qty” mentioned in the above logic.

You likely will need to create some server side logic to implement this:

  1. Create a new app and add it to frappe.
  2. Use the hooks.py to add your validation to the before_submit function of the Production Order.

You possibly could do it with a Custom Script in Production Order as well, but that isn’t as robust as the server side script.

1 Like

Thank You.
I kindly request you to tell more about

  1. "server side logic" with reference to virtual machine and how can I achieve that, I use virtualbox.
  2. creating app and adding to frappe
  3. what is hook.py, where do I find it and how can I add my validation

I know how to create the DocType ,insert field, alter fields, alter permissions, access module files (erpnext\erpnext\manufacturing\production order.py etc…) .

Kindly suggest me where do I start.