ERPNext Foundation ERPNext Cloud Chat Blog Discuss Frappé* Donate

Manufacturing process


#21

I would like to build a list of items, taken from an order, filter the list with the ones that need to manufactured (they have BOM + are not already available in finished products stock), and loop trough them to make all of the manufacture stock entries.
Need to learn more. And if you can help :slight_smile:

@hiousi,
I think what you need is already provided with the production planning tool. The tool will check on sales order by project or customer or sales order and will look for item with BOM and if they are not ready then they will either create 1. Production order if product is ready, 2. Material request if raw material not ready.

what we can is maybe to make c.script to move all the result of the Prod Planning tool to STE for our “mini” process instead of following normal workflow for production process. As you know prod planning tool already calculate almost all except it throw to Prod Order and Material Request.
What do you think?


#22

yes @tara_antonius oh yes can be great.

but:

  • The button “get items” get all items, even if there are available in finished product warehouse. We do not need to produce items that are already produced.
  • Production planning tool does not merge items to make production orders. If you have 10 orders, each with 10 item A, the tool will make 10 productions orders.

@tara_antonius Can you help in making a script that:

  • will check stock balance to see if an item is ready and does not need to be “mini manufactured”
  • will merge same items from differents orders in one STE.
  • all with the less clicks possible!

#23

After 1 month using the “mini manufacturing process” I realize that it is far from being perfect. I think it’s a “trick”, and ErpNext is not really designed to work like that.

  • Even if it’s far quicker than the “production planning tool->production order->stock entry” process, my finger is tired of clicking for each lines of each orders… save/submit cycle…
  • there is a major drawback with the stock reports. If you do not use a production order you are unable to know how much of raw materials are “reserved/planned”

argg. So what? is there is some people here that use ErpNext to drive the manufacturing of more than some items per day?


#24

@hiousi

Hi Hiousi,

Thanks for the feedback,
yes its a tiring manual process, we did not do a lot of item production thats why we don’t modify the erpnext for that.
Its just a trick to get the job done with less item to make, when it come to many things to produce i don’t think its that convenient.

I sugest is to make modified production planning tool as custom module, and do your material requirement and production planning from there, or we should ask the erpnext team to change that original module to cater your needs of:

  • will check stock balance to see if an item is ready and does not need to be manufacture.
  • will merge same items from differents orders in one STE.
  • all with the less clicks possible!

@komsel2228, bro do you think we can make custom module for the modified production planning tool for a better production process? as you know the production planning tool has some limitations as we discussed above?

Thanks and wish you all have a nice day

Anton


#25

Thought I’d add to this as I’m having similar issues. There is a method called get_production_items in the production planner tool that sets up the items to make production orders for. It also combines items that have the same item_code, sales_order and warehouse. To change it to only group items of same item_code you would modify this part. I think it’s fairly useful to be able to filter production orders by sales orders, which is why I haven’t done this.

""" Club similar BOM and item for processing in case of Sales Orders """
			if self.get_items_from == "Material Request":
				item_details.update({
					"qty": d.planned_qty
				})
				item_dict[d.item_code] = item_details

			else:
				item_details.update({
					"qty":flt(item_dict.get(d.item_code,{})
						.get("qty")) + flt(d.planned_qty)
				})
				item_dict[d.item_code] = item_details

You can also check stock balances for each item here. I’m using actual qty at the moment but I believe projected_qty would be more useful. The following finds each item entry that has enough stock balance (in all warehouses) and removes it.

                        remove = []
			for k in item_dict:
				balance_qty = 0


				stock_details = frappe.db.sql("select sum(actual_qty) from `tabBin` where item_code = (%s) group by item_code", item_dict[k]['production_item'])
				if stock_details:
					balance_qty = stock_details[0][0]

				if item_dict[k]['qty'] <= balance_qty:
					remove.append(k)
				else if balance_qty > 0:
					item_dict[k]['qty'] = flt(item_dict[k]['qty']) - flt(balance_qty)

			for k in remove:
				del item_dict[k]

I’m also working to automate the process a bit, but it requires using default values for source warehouse, wip warehouse and fg warehouse.

  1. Production planner tool submits the production orders and makes stock entries to transfer for manufacture as it makes each production order. These entries use a default source warehouse and wip warehouse.

  2. If material is in different warehouses each transfer stock entry has to be checked to choose the right warehouse. Definitely tedious, but if all material has the same default source warehouse this step can be skipped. This step can be automated a bit more by picking a source warehouse that has stock for the raw material item when the entry is created.

  3. Second button that gets all production orders based on criteria in planner (by sales order or material requests) and gets each transfer material for manufacture stock entry linked to it and submits it. Then makes and submits a manufacture stock entry. These entries use the default wip and fg warehouses.

I might have to make submitting the manufacture entry to another button. If a company has multiple wip or fg warehouses, they would need to modify each entry before submitting it.


#26

Hello @Kar_M, I’ve tried to use your code but maybe I misplaced something, can you help me?

        """ Club similar BOM and item for processing in case of Sales Orders """
        if self.get_items_from == "Material Request":
            item_details.update({
                "qty": d.planned_qty
            })
            item_dict[(d.item_code, d.warehouse)] = item_details
        else:
            item_details.update({
                "qty":flt(item_dict.get((d.item_code, d.warehouse),{})
                    .get("qty")) + flt(d.planned_qty)
            })
            item_dict[(d.item_code, d.warehouse)] = item_details
                
        remove = []
        for k in item_dict:
            balance_qty < 0
            
            stock_details = frappe.db.sql("select sum(projected_qty) from `tabBin` where item_code = (%s) group by item_code", item_dict[k]['production_item'])
            if stock_details:
                balance_qty = stock_details[0][0]
            if item_dict[k]['qty'] <= balance_qty:
                remove.append(k)
                    elif balance_qty => 0:
                item_dict[k]['qty'] = flt(item_dict[k]['qty']) - flt(balance_qty)
            
                for k in remove:
                        del item_dict[k]
    return item_dict

I want to group all itens with the same code to one production order if the projected_qty is < 0

I think that the sales orders or the material requests should be stored in a table, to maintain reference like itens in several sales orders.


#27

Hi @applepipe

The section that checks balances should be outside the for loop of that method. Other than that it should be exactly like what I posted above except with projected_qty. You’ve made some changes that would give errors. balance_qty < 0 and elif balance_qty => 0


#28

Hello @Kar_M,

Thanks for sharing this and for help! I was thinking that item table would be filled with the same items combined and with the necessary qty as planned qty, but it works when raising the orders.

Edit: I noticed that the production orders are raised with the full qty on orders, I need the qty to be the projected_qty, just enough to make the delivery. Do you have a sugestion on how to do it?


#29

Some feedback should be given if the items get grouped, but I haven’t gotten to that. As for the quantities, the part that determines quantity is below. Basically it should be checking if the qty to be produced is less than what we have, don’t produce anything. If it’s greater and the balance qty is greater than 0 then subtract balance qty from what we need to produce.

I’m not sure if that’s what you want.

if item_dict[k]['qty'] <= balance_qty:
					remove.append(k)
				else if balance_qty > 0:
					item_dict[k]['qty'] = flt(item_dict[k]['qty']) - flt(balance_qty)

#30

My first app ! learned a lot. I just copied Production Planning Tool to my own custom app to make the simplified production process as suggested by @tara_antonius.

it works like Production planning tool, but do not use Production orders.

  • Choose some Sales Orders.
  • get items with BOMs from those Sales Orders
  • click on “manufacture items”
  • Stock entries are created to move RAW material to finished product.

If you interested in it, download, install and test, test test. And, please, report what you think of it!


#31

@hiousi

hey congrats on the app and i wil download it to check it and test it.

will reply to you as soon as i checked.

thanks
Anton


#32

@hiousi nice! I guess I completely missed this thread.

Can you add some screenshots on how your tool works? Maybe we can add some features in the Production Order itself!


#33

@rmehta you will be surprised how it looks like production planning tool.

first choose the items to make from one or more SO…

click “Manufacture item” and get your Stock entries


#34

Nice! why not send a pull for this, a lot of users will thank you for it :smile:


#35

Hi hiousi,

We are into business of interior products and services where we manufacture items such as curtains and sofas etc. and other products and we have the concept of handing over job orders to workers along with raw material and their quanitities and details of finished products such as measurements are also added in the same.Following are few of queries will shall help me to determine if what you have developed can also be used by us,if you could reply to the same,it would be great help :

  1. In the production tool once it picks up items from the sales order does it only pick up item or even the raw material as in our case our items are highly customised according to customer even if the materials are same as mentioned in BOM the quantities could vary depending upon size of the finished goods,so I was wondering if we could get the materials in production tool and edit the quantites or add an item as well?Let me know if this could be possible?

  2. Once we click on manufacture can we create a material request instead of stock entry as quite few of our stock is placed in different warehouses or even needs to be ordered with suppliers so if we can create MREQ accordingly and then stock entry?


#36

hi @Boacasa,

my sript is very simple. It is not able to do all you need as is.

  1. basicaly the tool tooks an item out of the order, find its default BOM and submit a stock entry with raw material. You can change the code to not submit the SE, and create it as draft, edit quantity by hand and then submit it.

  2. it does not do that. It’s only capable to make a SE. But your idea is great, if you make it work please let me know :slight_smile:


#37

Hi @hiousi ,
I love your script. I have suggestion if you can add target warehouse in form that will help more faster process.
If you can guide me I can add target warehouse in form .


#38

Hi @hiousi ,Your Script is working perfectly fine. only one issue if we request items via material request form, after production material request form is in pending status. is there any way to change material request form status to completed?


#39

I think we can do without any change. Target comes from “Default Finished Goods Warehouse” inside “Manufacturing settings”. If empty it will be item’s default warehouse.
You can set up raw material source the same way using “Default Work In Progress Warehouse”, or leave it empty to take material from its default warehouse.