-
- Downloads
[FIX] purchase_{mrp,stock}: run procurement with buy route
In multi-steps receipt, when running a procurement, using "Buy" as preferred route does not always work because the route is not correctly configured To reproduce the issue: 1. In Settings, enable "Multi-Step Routes" 2. Edit the warehouse: - Incoming: 2 steps 3. Create a product P: - Type: Storable - Vendors: a vendor V - Routes: - Manufacture - Buy 4. Update on hand quantity: - -1 at WH/Stock 5. Open the Replenishment page - There should be a line with 1 x P 6. Set the Preferred route to "Buy" 7. Order Once Error: a user error is displayed "There is no Bill of Material of type manufacture [...] Please define a Bill [...]". This is incorrect, it should generate a PO The problem is simple: the Buy route is composed of one rule: - Action: Buy - Source Location: / - Destination Location: WH/Input But, when running the procurement, we first look for a rule to fulfill the need at WH/Stock. We prioritize the rules of the preferred route, but as explained above, the route does not contain such a rule. Therefore, we use the other routes of the product: https://github.com/odoo/odoo/blob/ba3bb9b701a382c4052ddb57392baeee32625937/addons/stock/models/stock_rule.py#L461-L466 And, because of step 3, it then finds the manufacture rule. This is the reason why it tries to create a MO and why an error is raised because of the missing BoM OPW-3006960 closes odoo/odoo#108550 Signed-off-by:William Henrotin (whe) <whe@odoo.com>
Showing
- addons/purchase_mrp/tests/test_purchase_mrp_flow.py 47 additions, 0 deletionsaddons/purchase_mrp/tests/test_purchase_mrp_flow.py
- addons/purchase_stock/i18n/purchase_stock.pot 2 additions, 1 deletionaddons/purchase_stock/i18n/purchase_stock.pot
- addons/purchase_stock/models/stock.py 17 additions, 0 deletionsaddons/purchase_stock/models/stock.py
- addons/purchase_stock/models/stock_rule.py 4 additions, 1 deletionaddons/purchase_stock/models/stock_rule.py
Loading