Skip to content

Conversation

@jbaudoux
Copy link
Contributor

As the call to _check_entire_pack can be very slow, bypass it's call when pre-computing the dynamic routing pull rules as this is not needed for the computation and will be rollbacked.

Also in case of source relocation, ensure to call _check_entire_pack on the recordset of moves and not on each move one by one. This is because _check_entire_pack triggers the check on the picking of the move and so you perform the same check for each move of the picking. When you reserve from source packages you have many moves inside a picking, the check is quite long and this change makes a important performance improvement.

When the dynamic routing does not change the source location, do not write the same value on the move as this triggers many useless additional recomputations.

cc @mt-software-de

@jbaudoux jbaudoux force-pushed the 14-perf-stock_dynamic_routing branch from 462cbbc to 78f5c93 Compare August 16, 2023 20:13
Copy link

@simahawk simahawk left a comment

Choose a reason for hiding this comment

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

Changes looks good.
I think it's time to upgrade these modules to dev status = production/stable as they are used in prod since years w/o major issues. WDYT?

@jbaudoux jbaudoux force-pushed the 14-perf-stock_dynamic_routing branch from 78f5c93 to 62a4b43 Compare August 17, 2023 07:56
As the call to _check_entire_pack can be very slow, bypass it's call
when pre-computing the dynamic routing pull rules as this is not needed
for the computation and will be rollbacked.

Also in case of source relocation, ensure to call _check_entire_pack on
the recordset of moves and not on each move one by one. This is because
_check_entire_pack triggers the check on the picking of the move and so
you perform the same check for each move of the picking. When you
reserve from source packages you have many moves inside a picking, the
check is quite long and this change makes a important performance
improvement.

When the dynamic routing does not change the source location, do not
write the same value on the move as this triggers many useless
additional recomputations.
Add test for the rerouting of waiting moves in a pull flow
@jbaudoux jbaudoux force-pushed the 14-perf-stock_dynamic_routing branch from 62a4b43 to 1ea674e Compare August 17, 2023 07:59
@jbaudoux
Copy link
Contributor Author

Changes looks good. I think it's time to upgrade these modules to dev status = production/stable as they are used in prod since years w/o major issues. WDYT?

stock_helper first needs to be changed to stable and it is in another repo. So I won't do the change in this PR

@jbaudoux jbaudoux requested a review from sebalix August 17, 2023 08:03
@jbaudoux
Copy link
Contributor Author

jbaudoux commented Aug 17, 2023

There was a feature for the re-routing of waiting moves in the chain (even when the pick location destination is not changed) that was not covered by a test. To be sure the performance changes are not breaking any feature, I have added a test for this.

This feature is deprecated in favor of the stock_warehouse_flow module but as this was initially offered by the dynamic routing you can still rely on the stock_dynamic_routing config for this.

@simahawk
Copy link

Changes looks good. I think it's time to upgrade these modules to dev status = production/stable as they are used in prod since years w/o major issues. WDYT?

stock_helper first needs to be changed to stable and it is in another repo. So I won't do the change in this PR

You are no the maintainer 😉 Can you take care of this on another PR? 🙏

Copy link

@mt-software-de mt-software-de left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@sebalix sebalix left a comment

Choose a reason for hiding this comment

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

LG, minor comments/questions

Comment on lines +25 to +26
if unconfirmed_moves:
unconfirmed_moves._apply_source_relocate()
Copy link

Choose a reason for hiding this comment

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

Does it change something to check the recordset here?

Should we instead do this check in the _apply_source_relocate method, if self is empty return.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No the method should not be called if not necessary.
Otherwise, all methods in odoo would start with if not self: return which is ugly

Copy link

Choose a reason for hiding this comment

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

Well, here except the debug log the method will do nothing. And as the Odoo API tends to be "functional-programming" in some way it's OK to call methods on an object without thinking if it's empty or not.

return new_move

def _after_apply_source_relocate_rule(self):
# Hook for stock_dynamic_routing
Copy link

Choose a reason for hiding this comment

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

Not sure we need to mention this module in stock_move_source_relocate? It's the job of the glue module (or anything else) to use this hook.

@jbaudoux
Copy link
Contributor Author

/ocabot merge minor

@OCA-git-bot
Copy link
Contributor

Hey, thanks for contributing! Proceeding to merge this for you.
Prepared branch 14.0-ocabot-merge-pr-722-by-jbaudoux-bump-minor, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit 7fa597c into OCA:14.0 Aug 22, 2023
@OCA-git-bot
Copy link
Contributor

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

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