-
- Downloads
[FIX] sale{,_stock}: decrease qty of SOL
When decreasing the qty of a SOL, if there is already a packaging defined, a return will be created for the difference To reproduce the issue: 1. Create a product P - Storable - With one packaging PK for 10 x P 2. Create and confirm a SO - Order Lines: - 10 x P with PK 3. On the SO, decrease the quantity of P to 8 Error: a return is created for the difference. Instead, the existing picking should be updated At some point, we try to merge the stock moves (`10 x P` and `-2 x P`) and, to do so, they must have the same `product_packaging_id`: https://github.com/odoo/odoo/blob/08f53ffa30479cfb452ebaed61b42655eb0e6a95/addons/stock/models/stock_move.py#L808-L813 However, on the SO, when decreasing the quantity, an onchange tries to find the best packaging. Because the new quantity is not a multiple of PK, this one is not returned. As a result, the SO has no more packaging and so does the new stock move (`-2 x P`). Therefore, the stock moves can not be merged and a new picking (the return) is created. This commit updates the onchange method so it behaves the same way as purchase side: https://github.com/odoo/odoo/blob/20fa7c6f0f5c9cdfae2519ea8d0ff849d7fa3b9e/addons/purchase/models/purchase.py#L1224-L1231 In this onchange, the same diff has recently be added for another reason (see [1]) [1] 20fa7c6f OPW-3027110 Part-of: odoo/odoo#105430
Loading
Please register or sign in to comment