Odoo 14 Community Edition
From what I understand, sale_line_id in stock.movemodel is added on creation only on the delivery order. Suppose I have 3 steps: pick,pack,out. Only out has a value in sale_line_id. I would like to customize so that all of the steps contain sale_line_id value.
So, I would like to know which method in which model that I have to make an adjustment in order for it to contain sale_line_id field for other steps as well.
I tried tracking down the flow, which I am not quite familiar with.
I have looked into these method but couldn't find the right method to do it.
_action_launch_stock_rule
_run_pull
_get_stock_move_values
_get_custom_move_fields
Update
I just found out that _action_launch_stock_rule method is called from sale order lines to create procurements that have sale_line_id. However, I still can't find where the other steps that have no sale_line_id field are created.
Stock Rule setup
PICK:
action: pull
procurement_method: make_to_stock
PACK:
action: pull
procurement_method: make_to_order
OUT:
action: pull
procurement_method: make_to_order
Note: I am not the one who configured this setup. I also don't know the reason why it is what it is.
Here the process that update
stock_moverecords to setsale_line_idusing the_prepare_procurement_valuesmethod. As @CZoellner said, you could inherit the model to append one entry in the returned dictionary of the def _prepare_procurement_values:in addons/stock/models/stock_move.py
Using the dictionary returned by def _prepare_procurement_values, the creation of "stock.move" records is performed under specific conditions (rules...): in addons/stock/models/stock_rule.py