Conversation
| company_id, origins, values | ||
| ) | ||
| values = values[0] | ||
| move_dest = values.get("move_dest_ids") |
There was a problem hiding this comment.
@AungKoKoLin1997 Did you test this code? I can't find the relevant code where move_dest_ids is assigned in values. The following line throws a server error because there is no move_dest.
There was a problem hiding this comment.
I can't find the relevant code where
move_dest_idsis assigned invalues.
https://github.com/OCA/OCB/blob/b1c66f1/addons/stock/models/stock_move.py#L1422
move_dest_ids is assigned in the MTO scenario, not in the scenario of orderpoint procurements, which is not considered in the current code.
| if move_dest_ids: | ||
| origin_move = self._find_origin_move(move_dest_ids[0]) | ||
| if origin_move and origin_move.raw_material_production_id.owner_id: | ||
| vals["owner_id"] = origin_move.raw_material_production_id.owner_id.id | ||
| return vals |
There was a problem hiding this comment.
@AungKoKoLin1997 Do you think we can simply do this, discarding the _find_origin_move() method? I guess we don't need to get to the very origin, as long as the parent inherits the value from its parent. Same for the purchase_mto_owner module.
| if move_dest_ids: | |
| origin_move = self._find_origin_move(move_dest_ids[0]) | |
| if origin_move and origin_move.raw_material_production_id.owner_id: | |
| vals["owner_id"] = origin_move.raw_material_production_id.owner_id.id | |
| return vals | |
| if move_dest_ids: | |
| vals["owner_id"] = move_dest_ids[0].raw_material_production_id.owner_id.id | |
| return vals |
There was a problem hiding this comment.
Yes. I will check and if the parent inherits the value from its parent, I will get rid of _find_origin_move.
2516ae0 to
b741d71
Compare
7b555c1 to
8ab5c08
Compare
1146626 to
8ab5c08
Compare
4207