Hi, I am currently evaluating Dolibarr for our business I am a bit confused about the workings of the “virtual stock”:
When creating a Manufacturing Order, the virtual stock of inputs is decreased (expected), but virtual stock of outputs is NOT increased. IS this the intended behaviour? It seems that this way, I can not use the virtual stock to find out if I can satisfy my customer orders with the planned productions. Or am I missing something here?
And related to that: there is this feature to show (virtual) stock at a given date in the future or in the past. I would have guessed that, e.g., the planned start/end date of a production and the planned delivery date of a customer order have a play in the virtual stock calculations here - e.g.: if a production is planned on a date in the future, then the virtual stocks of the involved products are only affected after that date. But this does not seem to be the case.
Looking forward to any enlightening comments
EDIT: for purchase orders, virtual stock is increased after the planned delivery date. this is what i would have expected for the outputs of production orders as well.
Did anybody already open a bug report on GitHub with a detailed description of how to reproduce the bug? This would definitely help to move things forward.
Note: Just do this if you know how to code in php or create a backup file first.
look for this function: load_stats_inproduction
I found it in line 3467.
The issue is when it executes the sql, it disregards the NULL value for the field named disable_stock_change of the item to be produced in the table named mrp_production in your database. It only looks for the 0 value as defined in the sql, particularly this line:
$sql .= " AND mp.disable_stock_change IN (0)";
I changed it to:
$sql .= " AND (mp.disable_stock_change = 0 OR mp.disable_stock_change IS NULL)";
so that NULL value will be included.
This is just a temporary fix but it works 100%.
I am still looking for the part of the code when it creates the item to be produced since by default it sets disable_stock_change to NULL. If you can find it, please let me know.
If I find it first, I’ll update this reply.
Side note: ChatGPT helped me a lot in finding the needle in the haystack. LOL