Skip to content

Conversation

@lase-odoo
Copy link
Contributor

Issue:

Currently, the default route set on an automatically created RR might not be set on the product.

Steps to reproduce:

  • In the settings: enable Multi-Steps Routes
  • On your warehouse set Manufacture in 3 steps
  • Create a storable product without any set route
  • Create a need for that product, for instance by creating and confirming an SO for 1 unit.
  • Inventory > Operations > Procurement > Replenishment

> A reordering rule was automatically created for your product but the manufacture route is set by default.

Cause of the issue:

Entering the replenishment tab will create orderpoints and set their default routes:

orderpoints = self.env['stock.warehouse.orderpoint'].with_user(SUPERUSER_ID).create(orderpoint_values_list)
for orderpoint in orderpoints:
orderpoint._set_default_route_id()
orderpoint.qty_multiple = orderpoint._get_qty_multiple_to_order()
However, the _set_default_route_id does not check that the route found to match a given orderpoint is actually selected on the product of the orderpoint:
def _set_default_route_id(self):
""" Write the `route_id` field on `self`. This method is intendend to be called on the
orderpoints generated when openning the replenish report.
"""
self = self.filtered(lambda o: not o.route_id)
rules_groups = self.env['stock.rule']._read_group([
('route_id.product_selectable', '!=', False),
('location_dest_id', 'in', self.location_id.ids),
('action', 'in', ['pull_push', 'pull']),
('route_id.active', '!=', False)
], ['location_dest_id', 'route_id'])
for location_dest, route in rules_groups:
orderpoints = self.filtered(lambda o: o.location_id.id == location_dest.id)
orderpoints.route_id = route

opw-4681202

I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@robodoo
Copy link
Contributor

robodoo commented Apr 2, 2025

Pull request status dashboard

@C3POdoo C3POdoo added the OE the report is linked to a support ticket (opw-...) label Apr 2, 2025
@lase-odoo lase-odoo marked this pull request as ready for review April 2, 2025 12:36
@C3POdoo C3POdoo requested review from a team and clesgow and removed request for a team April 2, 2025 12:39
@lase-odoo lase-odoo force-pushed the 17.0-opw-4681202-default_RR_route-lase branch from 051dbe4 to 2389b0b Compare April 3, 2025 06:47
@lase-odoo lase-odoo force-pushed the 17.0-opw-4681202-default_RR_route-lase branch from 2389b0b to 7bf08dc Compare April 4, 2025 09:14
Issue: Currently, the default route set on an automatically created RR
might not be set on the product.

Steps to reproduce:

- In the settings: enable Multi-Steps Routes
- On your warehouse set Manufacture in 3 steps
- Create a storable product without any set route
- Create a need for that product, for instance by creating and
  confirming an SO for 1 unit.
- Inventory > Operations > Procurement > Replenishment
> A reordering rule was automatically created for your product but the
> manufacture route is set by default.

Cause of the issue:

Entering the replenishment tab will create orderpoints and set their
default routes:
https://github.com/odoo/odoo/blob/884130330b600b4356c640cb679c2bb8fdb833a0/addons/stock/models/stock_orderpoint.py#L478-L481
However, the `_set_default_route_id` does not check that the route found
to match a given orderpoint is actually selected on the product of the
orderpoint:
https://github.com/odoo/odoo/blob/884130330b600b4356c640cb679c2bb8fdb833a0/addons/stock/models/stock_orderpoint.py#L323-L336

opw-4681202
@lase-odoo lase-odoo force-pushed the 17.0-opw-4681202-default_RR_route-lase branch from 7bf08dc to f49828e Compare April 4, 2025 10:22
@clesgow
Copy link
Contributor

clesgow commented Apr 4, 2025

LGTM, thanks for the fix!
@robodoo r+

robodoo pushed a commit that referenced this pull request Apr 4, 2025
Issue: Currently, the default route set on an automatically created RR
might not be set on the product.

Steps to reproduce:

- In the settings: enable Multi-Steps Routes
- On your warehouse set Manufacture in 3 steps
- Create a storable product without any set route
- Create a need for that product, for instance by creating and
  confirming an SO for 1 unit.
- Inventory > Operations > Procurement > Replenishment
> A reordering rule was automatically created for your product but the
> manufacture route is set by default.

Cause of the issue:

Entering the replenishment tab will create orderpoints and set their
default routes:
https://github.com/odoo/odoo/blob/884130330b600b4356c640cb679c2bb8fdb833a0/addons/stock/models/stock_orderpoint.py#L478-L481
However, the `_set_default_route_id` does not check that the route found
to match a given orderpoint is actually selected on the product of the
orderpoint:
https://github.com/odoo/odoo/blob/884130330b600b4356c640cb679c2bb8fdb833a0/addons/stock/models/stock_orderpoint.py#L323-L336

opw-4681202

closes #204449

Signed-off-by: Quentin Wolfs (quwo) <quwo@odoo.com>
@robodoo robodoo closed this Apr 4, 2025
@fw-bot fw-bot deleted the 17.0-opw-4681202-default_RR_route-lase branch April 11, 2025 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OE the report is linked to a support ticket (opw-...)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants