60e7803f3fbd552af40eb6154eaa804e70d0a54b
The allocation order is not based on the pickings order To reproduce the issue: (Need sale_management,mrp) 1. Create a storable product P 2. Create a BoM for another product dummy_P and add 1xP as component 3. Create and confirm a SO with 1x product P 4. Create and confirm a MO for 1x dummy_P 5. Process a receipt transfer with one P Error: On the SO, the reserved quantity is still 0. The product has been reserved for the MO, even if the picking of the SO has been created first The default order of several SM is based on the sequence and the identifier: https://github.com/odoo/odoo/blob/abc9fdaae2927214d98082f391a1dc0fc75e4c77/addons/stock/models/stock_move.py#L26 The default value of the field `sequence` is 10: https://github.com/odoo/odoo/blob/abc9fdaae2927214d98082f391a1dc0fc75e4c77/addons/stock/models/stock_move.py#L26 When creating a SO, the field isn't defined so its default value is used (10). However, when creating the MO, the field is defined thanks to the sequence of the related BOM line: https://github.com/odoo/odoo/blob/864d90a064f093bd6ba24d8464ee491a443a320e/addons/mrp/models/mrp_production.py#L940 Which, in our case, is equal to 1 As a result, when allocating the quantities in `_action_assign`, the recordset will contain first the SM of the MO and then the SM of the SO. This commit ensures the order will be based on the priority, the date and the identifier (the latter allows the search result to be deterministic) Side note: this commit also adds the identifier to the search in `_run_scheduler_tasks` to keep consistency between the different flows OPW-2524205 closes odoo/odoo#78497 X-original-commit: da2b336d467d95cda8ed21707535fb7119f5d777 Signed-off-by: Rémy Voet <ryv-odoo@users.noreply.github.com> Signed-off-by: Adrien Widart <adwid@users.noreply.github.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%