Item is fetched in Production Plan although it's already manufactured against another sales order

Hi,

I have a list of items in a Sales Order that I am manufacturing using the Production Plan tool. While creating the production plan for one of the items, when I click on the Get Sales Order button, I found two sales orders are pulled in to the table (the current and the previous sales order).
My approach of production plan is to plan for one production plan at a time, meaning I create the production plan after every sales order and when the production plan is complete for all the items of the sales order, I create delivery note and sales invoice to complete the work and then move on to creating the next sales order and start another production plan.
I have never seen two different sales order to be pulled in to one production plan for the same product to manufacture as I would always complete producing the product for each sales order.

Here is the example:
Current Sales Order:

Current Production Plan:

Previous Sales Order:


Previous Work Order Showing the full qty produced and Completed:

Stock Entry confirming material transferred to manufacture for full qty:

Stock Entry confirming full Qty manufactured:

Can anybody clarify and help why the same product is being pulled in for the current production plan?

I would appreciate some help here please.

the check is on work order submit. of course ideally, already planned sales order should be excluded in another production plan.

Could this be a bug in the application for same item appearing on sales order in two different lines? I have checked the Work Order and as shown in the screenshots above the work order was completed for 960 qty (600 from line 1 and 360 from line 2).

Has anyone encountered this issue? When a production plan is made from Sales order with same item in two lines (due to different packaging) it consolidates the total quantity and manufactures it however the next production plan when made with another sales order that has same item, the system is pulling both sales orders and showing one of the line item as not produced from the previous sales order.

Example: Sales Order - 001
Item-001 Qty 600
Item-001 Qty 360

Production Plan 001
Item-001 Qty 960 (From Sales Order- 001)

Work Order 001
Qty Manufactured: 960

Sales Order - 002
Item-001 Qty: 360

Production Plan-002
Item-001 Qty 600 (From Sales Order- 001)
Item-001 Qty 360 (From Sales Order- 002)

Production Plan-002 should never fetch item-001 from Sales order-001 as that’s already processed and stock entries for both material transfer to manufacture and material manufactured are updated with Qty 960.

I have tried to cancel the Production plan along with all connection doctypes and tried again with the same result. It appears like a BUG to me but I would like to know if anyone else has encountered this issue.
I am running ERPNext version 13.2

Can anybody assist? I am able to reproduce this issue. Any help would be very much appreciated.