Skip to content

[18.0][IMP] stock_mts_mto_rule: Several improvements - #2609

Open
rousseldenis wants to merge 6 commits into
OCA:18.0from
acsone:18.0-imp-stock_mts_mto_rule_dro
Open

rousseldenis wants to merge 6 commits into
OCA:18.0from
acsone:18.0-imp-stock_mts_mto_rule_dro

Conversation

@rousseldenis

Copy link
Copy Markdown
Contributor

No description provided.

As Odoo does it in stock core module and because running procurements
one per one is suboptimal, group procurements run per action.
@OCA-git-bot OCA-git-bot added series:18.0 mod:stock_mts_mto_rule Module stock_mts_mto_rule labels Jul 6, 2026
@rousseldenis

Copy link
Copy Markdown
Contributor Author

@florian-dacosta I've merged the migration PR: #2489

This in order to gather some improvements in this PR with better readability.

As discussed in #2458, I've removed an unwanted constraint.

@florian-dacosta @ypapouin I've refactored the way this behaves as I've observed great performances problems if procurements runs are not grouped.

Do you see anything that I should pay attention to with that change ?

Many thanks

@rousseldenis

Copy link
Copy Markdown
Contributor Author

FYI, I passed from 500 seconds to 55 to run the scheduler with this change. 😄

@ypapouin

ypapouin commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@rousseldenis, I agree about the unneeded constraint , it's already removed on my side since it breaks existing workflows on our production database.

About the procurement grouping, I didn't made any tests and I may be wrong about it, but I believe that it would lead to different results (that initial implementation): since all evaluation is done first and all processing is done after with your change, that means that when the first procurement run it will change stock quantities, quantities that would normally have an impact on the 2nd procurement (same product, etc.) that would adapt its split logic.

If I'm right, this optimization could still be possible if products are not the same.

@rousseldenis

Copy link
Copy Markdown
Contributor Author

@rousseldenis, I agree about the unneeded constraint , it's already removed on my side since it breaks existing workflows on our production database.

About the procurement grouping, I didn't made any tests and I may be wrong about it, but I believe that it would lead to different results (that initial implementation): since all evaluation is done first and all processing is done after with your change, that means that when the first procurement run it will change stock quantities, quantities that would normally have an impact on the 2nd procurement (same product, etc.) that would adapt its split logic.

If I'm right, this optimization could still be possible if products are not the same.

@ypapouin Thanks for this.

Indeed, I think I need to refine the logic in order to keep the procured quantity for each product by location. And do tests on that 😄

To improve performances, we grouped procurements runs. This has a drawback
as if several procurement for the same location and for the same product
are run together, the resulting moves will not take into account the preceding
taken quantities. This fixes that.
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.

3 participants