-
Notifications
You must be signed in to change notification settings - Fork 7.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Work Order throws Overproduction Error if Item exists multiple times in Sales Order #37497
Comments
Actually I think in most cases it is the desired behaviour to have one work order for each sales order position. This is of value for instance if each sales order item has a different delivery date. |
@rohitwaghchaure Can you maybe please check the issue? I suppose that minor changes to the code lead to an overall enhancement of the manufacturing module. Maybe that an if-else-branch is needed to check if the item to produce is linked to an Sales Order Item, since you can also use the Production Plan without the linking against a Sales Order. |
Sorry that I post the possible solution here. If I find some time I will learn how to create proper pull requests for frappe/erpnext.
The solution works like a charm and enables the Production Plan to fulfill the feature "Allow Item to be Added Multiple Times in a Transaction" of the Selling module. Would be great if you guys could have a look and maybe merge the modification into the core code. |
Information about bug
Problem
In case "Allow Item to be Added Multiple Times in a Transaction" is enabled in the Selling Settings it is possible to add an item mutliple times to the Sales Order.
Now you can use the Production Plan to generate Work Orders for that Sales Order. The Production Plan then sums up the quantities of the multiple positions of the item and creates one Work Order.
On saving the Work Order the validation for overproduction is triggered. The qty to produce of the Work Order is the sum of the multiple positions of the item. Therefore it exceeds the qty to produce of the single position in the Production Plan. Hence the Overproduction Error is thrown.
Possible Solution
A possible solution is not to sum up the quantities of the multiple positions. Instead create a Work Order for each position in the Production Plan.
Change line 576 of erpnext/manufacturing/doctype/production_plan/productan_plan.py from
item_dict[(d.item_code, d.sales_order, d.warehouse)] = item_details
toitem_dict[(d.sales_order_item, d.sales_order, d.warehouse)] = item_details
would do the trick.Then you will receive a Work Order for each Sales Order Item and all links and validations shall work out-of-the-box as expected.
Module
manufacturing
Version
ERPNext: v14.44.0 (HEAD)
Frappe Framework: v14.52.0 (HEAD)
Frappe HR: v14.13.1 (HEAD)
Payments: v0.0.1 (version-14)
Installation method
docker
Relevant log output / Stack trace / Full Error Message.
The text was updated successfully, but these errors were encountered: