8517a66b145173a6004eba8410ff7ffe506c68d8
Steps to reproduce the bug:
- Create a storable product P1:
- Create a BoM:
- type: subcontracting
- Add vendor
- Add any component
- Create a purchase order with 3 units of P1
- Confirm the purchase order
- Go to the picking
- receive 2 units of P1 and validate it
- create a backorder
- Cancel the backorder
- Try to update the purchased qty in the PO line
Problem:
A user error is triggered:
“Nothing to check the availability for.”
When updating the quantity in the purchase order line, the
"_create_or_update_picking" function is called to search for a linked
picking and update its quantity. However, in our case, since no picking
can be updated, a new picking is created:
https://github.com/odoo/odoo/blob/783048616362702f/addons/purchase_stock/models/purchase.py#L271-L272
Subsequently, the moves are confirmed:
https://github.com/odoo/odoo/blob/e38ed7c780d35fb9d5d799ac783048616362702f/addons/purchase_stock/models/purchase.py#L277
However, as the product is subcontracted, the "action_assign" function
is called: https://github.com/odoo/odoo/blob/4055293873132d56fe3787c77e499808b136f300/addons/mrp_subcontracting/models/stock_move.py#L105-L106
Since there is no move in the confirmed state, a user error is
triggered: https://github.com/odoo/odoo/blob/d45996c9155b9576c74aa8c6c6f718f8ab4d0af6/addons/stock/models/stock_picking.py#L450-L453
Solution:
When updating the quantity in the purchase order, if no picking requires
an update, it is better to avoid creating a new picking.
opw-3616381
closes odoo/odoo#151422
X-original-commit: 636fa777aabec77e3622560f7a80435a56d088da
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
…
…
…
Odoo
Odoo is a suite of web based open source business apps.
The main Odoo Apps include an Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, ...
Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.
Getting started with Odoo
For a standard installation please follow the Setup instructions from the documentation.
To learn the software, we recommend the Odoo eLearning, or Scale-up, the business game. Developers can start with the developer tutorials
Languages
Python
49.6%
JavaScript
47.8%
SCSS
2%
CSS
0.3%
HTML
0.2%