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

[WMS][12.0] Add stock_move_location_dest_constraint_base - alpha version #696

Conversation

grindtildeath
Copy link
Contributor

This module provides a base mechanism to constrain the selection of destination
location on stock move lines.
It also adds a checkbox 'Bypass constraints' on stock location to deactivate
the checks implemented by installed modules.

Related to #691

@grindtildeath grindtildeath changed the title [WMS][12.0] Add stock_move_location_dest_constraint_base [WMS][12.0] Add stock_move_location_dest_constraint_base - alpha version Sep 5, 2019
@jgrandguillaume
Copy link
Member

@grindtildeath I have the following error while trying to receive products.

To replicate this, I have a put away in input location (with bybass constraints set) to put it away in input /WAE for all product category.

Traceback (most recent call last): File "/odoo/src/odoo/http.py", line 654, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/odoo/src/odoo/http.py", line 312, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/odoo/src/odoo/tools/pycompat.py", line 87, in reraise raise value File "/odoo/src/odoo/http.py", line 696, in dispatch result = self._call_function(**self.params) File "/odoo/src/odoo/http.py", line 344, in _call_function return checked_call(self.db, *args, **kwargs) File "/odoo/src/odoo/service/model.py", line 97, in wrapper return f(dbname, *args, **kwargs) File "/odoo/src/odoo/http.py", line 337, in checked_call result = self.endpoint(*a, **kw) File "/odoo/src/odoo/http.py", line 939, in __call__ return self.method(*args, **kw) File "/odoo/src/odoo/http.py", line 517, in response_wrap response = f(*args, **kw) File "/odoo/src/addons/web/controllers/main.py", line 966, in call_button action = self._call_kw(model, method, args, {}) File "/odoo/src/addons/web/controllers/main.py", line 954, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/odoo/src/odoo/api.py", line 749, in call_kw return _call_kw_multi(method, model, args, kwargs) File "/odoo/src/odoo/api.py", line 736, in _call_kw_multi result = method(recs, *args, **kwargs) File "/odoo/src/addons/purchase/models/purchase.py", line 331, in button_confirm order.button_approve() File "/odoo/src/addons/purchase_stock/models/purchase.py", line 87, in button_approve self._create_picking() File "/odoo/src/addons/purchase_stock/models/purchase.py", line 214, in _create_picking moves._action_assign() File "/odoo/external-src/stock-logistics-warehouse/stock_picking_zone/models/stock_move.py", line 11, in _action_assign super()._action_assign() File "/odoo/src/addons/stock/models/stock_move.py", line 914, in _action_assign self.env['stock.move.line'].create(move._prepare_move_line_vals(quantity=missing_reserved_quantity)) File "/odoo/src/addons/stock/models/stock_move.py", line 803, in _prepare_move_line_vals location_dest_id = self.location_dest_id.get_putaway_strategy(self.product_id).id or self.location_dest_id.id File "/odoo/src/addons/stock/models/stock_location.py", line 132, in get_putaway_strategy putaway_location = current_location.putaway_strategy_id.putaway_apply(product) File "/odoo/src/addons/stock/models/product_strategy.py", line 29, in putaway_apply put_away = self._get_putaway_rule(product) File "/odoo/external-src/stock-logistics-warehouse/stock_move_location_dest_constraint_base/models/product_strategy.py", line 15, in _get_putaway_rule return super()._get_putaway_rule(product) File "/odoo/src/addons/stock/models/product_strategy.py", line 42, in _get_putaway_rule put_away = self.fixed_location_ids.filtered(lambda x: x.category_id == categ) File "/odoo/external-src/stock-logistics-warehouse/stock_move_location_dest_constraint_base/models/product_strategy.py", line 31, in filtered put.location_id.check_move_dest_constraint(product=product) AttributeError: 'stock.fixed.putaway.strat' object has no attribute 'location_id'

filtered_putaways = self.browse()
for put in putaway_strats:
try:
put.location_id.check_move_dest_constraint(product=product)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
put.location_id.check_move_dest_constraint(product=product)
put.fixed_location_id.check_move_dest_constraint(product=product)

Copy link
Member

@jgrandguillaume jgrandguillaume Sep 6, 2019

Choose a reason for hiding this comment

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

I confirm this fix the problem

@jgrandguillaume jgrandguillaume mentioned this pull request Sep 13, 2019
32 tasks
@max3903 max3903 added this to the 12.0 milestone Dec 31, 2019
Copy link
Member

@jgrandguillaume jgrandguillaume left a comment

Choose a reason for hiding this comment

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

Let' merge this now. We'll bring other improvemnts later on for perfe reasons

@jgrandguillaume
Copy link
Member

/ocabot merge

@OCA-git-bot
Copy link
Contributor

Hi @jgrandguillaume. Your command failed:

Required option bumpversion_mode for command merge. Possible values : major, minor, patch, nobump.

Ocabot commands

  • ocabot merge major|minor|patch|nobump

More information

@jgrandguillaume
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 12.0-ocabot-merge-pr-696-by-jgrandguillaume-bump-nobump, awaiting test results.

@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at ebebd84. Thanks a lot for contributing to OCA. ❤️

@OCA-git-bot OCA-git-bot merged commit 3fbc503 into OCA:12.0 May 28, 2020
grindtildeath added a commit to grindtildeath/stock-logistics-warehouse that referenced this pull request Sep 18, 2020
This reverts commit 3fbc503, reversing
changes made to 09b9de7.
pedrobaeza added a commit that referenced this pull request Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants