Version: v15.75.1 (and likely other recent versions)
Summary:
There is a core bug in the manufacturing module that incorrectly doubles the required quantity of a raw material in both Production Plans (via “Get Materials”) and Work Orders.
I have done extensive testing and have 100% confirmed the trigger:
The bug only happens if an item’s Item Code is identical to its Item Group name. (e.g., an item with Item Code Labor is assigned to the Item Group Labor).
Steps to Reproduce (on a 100% Clean Install)
This bug is present on a brand-new, un-customized installation (tested on a fresh Docker setup).
-
Create Item Group: Create a new Item Group named
Test Group. -
Create “Bad” Item: Create a new Item with the Item Code
Test Group(the exact same name as the group). Assign this item to theTest GroupItem Group. -
Create “Good” Item: Create a new Item with the Item Code
Good Itemand assign it to the sameTest Group. -
Create BOM: Create a BOM for a finished product. In the materials list, add:
-
1 unit of
Test Group(the “bad” item) -
1 unit of
Good Item
-
-
Create Work Order: Create a new Work Order for 1 unit of the finished product.
-
Observe Bug: In the “Required Items” table, the quantity for
Good Itemwill be correct (1), but the quantity forTest Groupwill be incorrectly doubled to 2.
In-Depth Analysis & Proof
This is not a configuration, cache, or data error. This is a flaw in the application’s code logic.
-
Proof 1: The Trigger is Proven
-
If I rename the Item Code of the “bad” item from
Test GrouptoTest Group-2(but keep it in the same group), the bug disappears. -
If I delete the item and recreate it with the exact same Item Code in the exact same Item Group, the bug comes back.
-
-
Proof 2: It is NOT a Caching Bug
-
Running
bench clear-cachedoes nothing. -
Running
redis-cli flushall(to nuke the entire Redis cache) does nothing. The bug happens instantly when the data is re-fetched from the database.
-
-
Proof 3: It is NOT a Database Error
-
I did a full database
diffby dumping the SQL rows for the “good” item and the “bad” item from thetabItemtable. -
I also did a
diffon their parenttabItem Grouprecords. -
The records are 100% functionally identical. There is no “ghost” property, flag, or setting that is different.
-
Conclusion: The core manufacturing code is incorrectly checking if item.name == item.item_group (where item.name is the database field for Item Code). When this condition is true, it mistakenly treats the item as a sub-assembly and “explodes” it, which incorrectly doubles the quantity.
The Workaround (For Other Users)
The only solution is to ensure no Item has an Item Code that is identical to its Item Group name.
Renaming either the Item Code or the Item Group so they do not match will immediately fix the problem for that item.