Custom script not working - Manuf module

I would not recommend changing the stock_entry.py file, as you will make your system incompatible with future ERPNext updates. I think you need to examine your usage case and see if there is another way around this. If you are just moving stock around, you don’t need to reference a PO number, you can probably just use the From BOM button and use a BOM with a quantity to move.

Please explain why you need to link it to a Production Order?

1 Like

@Ben_Cornwell_Mott . Many thanks for the response ,

I am developing the erp for a forging company , as there is no provision in our package to determine the quantity of products available in different workstation , i determined to use the warehouse option , actually I need to track the finished goods in different workstation/warehouse .

I tried editing the stock entry js file to automatically fetch the item_code and qty when I enter the production order number , but finally I gave up and I am planning to edit the py file at last , anyway I am not going to update .

The reason why I insist this is the product goes thru lot of process/operations and each operation happens in different warehouse by doing this I will be able to create a report to find out where the item is and which operation is currently going on . So , right from the beginning of transferring materials to manuf till the end there will be lot of material issue , receipt and transfer between the workstations .

As a workaround I created a new field production_order1 and tried updating the items automatically when I select the production number , but to my dis luck it is not getting updated either .

Please could you help me .

Thanks

The way you keep track of the products at each workstation is by creating a warehouse for each workstation, and have a BOM for each operation. For example:

Part 1 turns into Item 5 through a series of operations: Ops 1-4
After each operation, you technically have a different part, so after you perform Op1 on Item 1, you have Item 2, etc.
For Item 2-5, make sure the Default Material Request Type is Manufacture

Each operation takes place at a different workstation, Station 1-4.
Assign a warehouse to each workstation: Warehouse 1-4

Create a BOM for each Item (1-5) and each BOM has the Operation that transforms it there. For example,

BOM-Part 2-001 has Item 1 as an input, and has one operation, Op 1. The output is Item 2
BOM-Part3-001 has Item 2 as an input, and has one operation, Op 2. The output is Item 3

When you go to create a production order through the Production Planning Tool, you’ll do it for Item 5, and make sure you do a single-level BOM (Once v7.1 is out, you’ll be able to do this all in one step, but for now you have to do it in 5 steps). This is where you will set the finished goods warehouse (in each item line of the Items) and the reserved goods warehouse (Material Request for Items). When you create the material requests, you’ll generate a Material Request for Manufacture for Item 4. You can use the Production Planning Tool again, this time loading items from the recently created Material Request, and set your warehouses again. Repeat this process until you create Material Requests for your raw goods.

Once all this is set up, you can process each production order in sequence, first to move parts to Workstation 1 (Warehouse 1), then use the next production order to go to Workstation 2, etc.

1 Like

Hi @Ben_Cornwell_Mott . Many thanks for spending your time to guide me . I already tried this , my problem is I cannot have more than than one production order for a particular item and ideally it is not correct to have more than one production order for an item . Also creating 9 production order ( since I have 9 operations ) will consume lot of time .

Now I got an idea , I mean a workaround for this issue ,
I am planning to create a custom field production_order1 and call the values and put that in the items table .Is this correct ? Shall I proceed doing this instead of removing the validations ?

Thanks

I’m not sure what you mean by not being able to have more than one production order for an item. You often should have more than one production order for an item, and I’m not sure why you think it’s incorrect to.

Once v7.1 comes out, you’ll be able to easily create the 9 production orders in just a couple quick steps (which supports the idea of not changing the base code and preventing your system from being update compatible).

Finally, I really don’t understand what the custom field will do, and how that will help you. If you need to add the items and quantities, you can use the From Stock checkbox, which will allow you to move stock between warehouses. That said, I think the way I proposed is a better way to move forward, because it uses the functionality of the system as it was intended.

1 Like

@Ben_Cornwell_Mott . Many thanks for the reply . With the help of the custom field I will try to fetch the values manually like how it works when the production order is in process .

Many thanks for spending your time to guide me .I will update you and explain in detail what I have done .

Thanks