OCA / stock-logistics-warehouse

Odoo Warehouse Management Addons
https://odoo-community.org/psc-teams/logistics-18
GNU Affero General Public License v3.0
320 stars 718 forks source link

[FIX] stock_mts_mto_rule: multiple procs same product #2098

Open ferran-S73 opened 4 months ago

ferran-S73 commented 4 months ago

Reopen of https://github.com/OCA/stock-logistics-warehouse/pull/1872

When launching 2 mts+mto procurements for the same product, if the first one has a greater o equal qty than the second, the second won't run it's mto action. This is because the replenishment move gets confirmed whereas the original moves are still in drat state.

Steps to reproduce the issue:

Debugging the code I found out that when the _run_split_procurement method calls get_mto_qty_to_order for the second procurement the product virtual_available includes the qty that from the manufacturing order created by the first proc (it's move is confirmed) but isn't taking into account the sale's move as it is still in draft. So I think we can take this into account by keeping track of what's being replenished for each product.

jbaudoux commented 1 month ago

FYI @TDu @mt-software-de

rousseldenis commented 2 weeks ago

@ferran-S73