Skip to content

Conversation

@yostashiro
Copy link
Member

company_id, origins, values
)
values = values[0]
move_dest = values.get("move_dest_ids")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't find the relevant code where move_dest_ids is assigned in values.

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.

Comment on lines 34 to 36
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
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Suggested change
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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I will check and if the parent inherits the value from its parent, I will get rid of _find_origin_move.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 4207-add-purchase_mto_owner branch from 2516ae0 to b741d71 Compare February 23, 2024 04:24
@yostashiro yostashiro force-pushed the 4207-add-purchase_mto_owner branch from 7b555c1 to 8ab5c08 Compare March 30, 2024 16:09
@yostashiro yostashiro changed the title [4207][ADD] purchase_mto_owner, mrp_mto_owner [4207][ADD] mrp_mto_owner Mar 30, 2024
@yostashiro yostashiro force-pushed the 4207-add-purchase_mto_owner branch from 1146626 to 8ab5c08 Compare April 1, 2024 07:45
Copy link
Contributor

@kanda999 kanda999 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functional check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants