9a5df70861362428d316083b1aed3db9d7fd7e8e
When processing a batch without backorder, if a picking is not fully done, it will be removed from the batch To reproduce the issue: 1. Create two delivery pickings P1 et P2 with demands = 5 2. Have the quantity in the stock 3. Add both to a batch and confirm it 4. Set the done quantity on P1 5. On P2, set a done quantity to 4 6. Process the batch without backorder Error: Both pickings are done, and so does the batch, but P2 is not linked to that batch anymore When processing the batch, we will call `button_validate` on the pickings recordset https://github.com/odoo/odoo/blob/213b74be16cecc50e6e99c00f47786a9cbf327a8/addons/stock_picking_batch/models/stock_picking_batch.py#L252-L258 Later on, there is an override of `StockPicking._action_done` in the batch module. In this override, once we have called `super`, we then ensure that all pickings of the batch are done, else we detach some of them: https://github.com/odoo/odoo/blob/213b74be16cecc50e6e99c00f47786a9cbf327a8/addons/stock_picking_batch/models/stock_picking_batch.py#L252-L258 But here is the issue: as mentionned above, we first call `button_validate` on pickings recordset. In this method, we will call `StockPicking._action_done` two times: https://github.com/odoo/odoo/blob/ca168f7fbcbb8a300a8fa0b46f79a6c116b5aa93/addons/stock/models/stock_picking.py#L1088-L1089 The first time, for the pickings without the backorder option (P2 in the above use case), and the second time, for the pickings with the backorder option (P1 in the above use case). As a result, during the first call, we reach the override in batch module, and of course, P1 is not yet processed (it will be done during the second call of `_action_done`). Therefore, we think there is an inconsistency, and we detach P2. OPW-3346255 closes odoo/odoo#132037 X-original-commit: c2817285adf9dd44ad7155963f08d324995ba072 Signed-off-by: William Henrotin (whe) <whe@odoo.com> Signed-off-by: Adrien Widart (awt) <awt@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%