Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3758][IMP] stock_owner_restriction, mrp_stock_owner_restriction #83

Merged
merged 4 commits into from
Oct 10, 2023

Conversation

yostashiro
Copy link
Member

3758

stock_owner_restriction:

[IMP] stock_owner_restriction: increase method coverage

Extend following methods for the scenario where owner restriction should be forced:

  • _update_available_quantity() (stock.quant)
  • _update_reserved_quantity() (stock.quant)

Split lines to identify the owner_restriction setting into separate method for
better extensibility.

Fix read_group() (stock.quant) which was incorrectly assigning the owner record
in the domain instead of the id.

mrp_stock_owner_restriction:

[IMP] mrp_stock_owner_restriction: add handling of umbuild orders

Extend following methods for the scenario where owner restriction should be forced:

- _update_available_quantity() (stock.quant)
- _update_reserved_quantity() (stock.quant)

Split lines to identify the owner_restriction setting into separate method for
better extensibility.

Fix read_group() (stock.quant) which was incorrectly assigning the owner record
in the domain instead of the id.
Comment on lines 42 to 46
restricted_owner = self.env.context.get("force_restricted_owner_id", None)
if restricted_owner is not None:
domain = expression.AND(
[domain, [("owner_id", "=", restricted_owner.id)]]
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I just realized this changes is not valid. I think this changes will lead to error when we search the quantity only for no owner_id (https://github.com/OCA/stock-logistics-workflow/blob/4b0301ca409ade61958fd09d50a10209d064b6c5/stock_owner_restriction/models/product.py#L27-L36). The intention of force_restricted_owner_id is ID or False from somewhere.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you fix this so that the error does not occur?

Copy link
Contributor

Choose a reason for hiding this comment

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

I can fix but I want to know is there is any reason to change from restricted_owner_id to restricted_owner? If not, I will revert it and make adjustments.

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 fix but I want to know is there is any reason to change from restricted_owner_id to restricted_owner? If not, I will revert it and make adjustments.

Due to the convention. xxx_id as a variable usually represents an id (integer), which is not the case here.

@AungKoKoLin1997 AungKoKoLin1997 force-pushed the 3758-imp-mrp_stock_owner_restriction branch from e7f6af7 to ac49fe1 Compare October 4, 2023 07:50
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 review

@kanda999 kanda999 merged commit ab1fc60 into 16.0 Oct 10, 2023
1 check passed
@yostashiro yostashiro deleted the 3758-imp-mrp_stock_owner_restriction branch April 3, 2024 07:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants