-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
[14.0][MIG] stock_putaway_hook #772
Conversation
Add hooks allowing modules to add more putaway strategies. It adds hooks to the core putaway method ``StockLocation._get_putaway_strategy()`` allowing to plug other strategies and makes the selector fields in the tree views dynamic (required/readonly). The fields_view_get override is to handle a tricky issue: By default, the product_id field as such attrs: "{'readonly': [('category_id', '!=', False)], 'required': [('category_id', '=', False)]}" And the category_id field: "{'readonly': [('product_id', '!=', False)], 'required': [('product_id', '=', False)]}" If we add a new field "route_id", we want to extend the domains to include it, such as: "{'readonly': ['|', ('category_id', '!=', False), ('route_id '!=', False)], 'required': [('category_id', '=', False), ('route_id', '=', False)]}" And every new field will need to be added in the product_id and category_id field, but also in the other fields (exemple, if we add a "foo_id" field, it needs to be added in the attrs of "route_id"), which isn't possible with the extension mechanisms of the XML views. The solution provided by this module is that new fields must have the {'exclusive_selection': True} in the options attribute, and an override of fields_view_get automatically generates the attrs for all these "exclusive" fields. The code here will be tested by `stock_putaway_by_route` in a follow-up commit.
The module matching a putaway rule by a route can now: * find a putaway rule by the route related to a stock move * or a route related to the product on the move The changes required to enable this feature: * In stock_putaway_hook: in the part that match the value, support "in" when the value is a container (recordset, list, tuple), so we can pass product.route_ids (and match any route set on a put-away rule) * In stock_putaway_by_route, in the various parts where `StockLocation._get_putaway_strategy()` is called, propagate the product's routes as well * In StockMoveLine.onchange_product_id, remove the computation based on self.move_id: it cannot change.
ping @guewen |
667ed2b
to
ddf3b6f
Compare
This PR has the |
Force pushed to make pre-commit happy. |
@rousseldenis can you please merge ? |
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at 30ce269. Thanks a lot for contributing to OCA. ❤️ |
No description provided.