When a MO has been generated after the execution of the Inventory Scheduler and an RFQ and subsequent PO is issued to fulfill the BOM for the manufactured part we expect that the appropriate stock moves ( MO’s Consumed Materials: stock.move ) would be updated with the Purchase Order Line, Forecasted Quantity, Expected Date to fulfill the BOM’s requirement.
The primary goal is just to have an understanding of whether or not the parts have been ordered.
The stock.move has fields for the following
Purchase Order Line: purchase_line_id
Forecasted Quantity: availability
Expected Date: date_expected
I have found a bunch of code relating to the above fields which appear to try to update the stock.move records when the Purchase Order Line has been written to. These functions appear to be predicated on the purchase_line_id of the stock.move record. In my testing I have not found any purchase_line_id on the stock.move records which I expect is the cause of the issue.
Because Odoo identifies the stock.move records to update by searching for stock moves with the same purchase_line_id as the Purchase Order Line in question then Odoo can't do that if the field is not set.
So I guess my question is what would cause the purchase_line_id to not get written to the stock move and under what circumstances should I expect the purchase_line_id to be written to a stock move?