7d9d6e8834c18ed9fa2189aed53b64ae9df1c024
stock.move.lineresponssible for quant reservation
A lot of issue with "It is not possible to unreserve more products of ... than you have in stock". It's the result of a desynchronisation between `stock.move.line`.`reserved_qty` and `stock.quant`.`reserved_quantity` fields. It should never happens in theory. However we already faced it a lot due to bugs/custom code/server actions... It's not trivial to fix because the issue come from data corruption. So it is hard to spot the different main issues. In order to avoid it, this commit try to modify the structure of stock module. Before the operations was made in this order: - The `stock.move` checks the quantity available on `stock.quant` - The `stock.move` write the quantity reserved on the `stock.quant` and save it in a variable - The `stock.move` create a `stock.move.line` with the quanity reserved. The main issue is that a `stock.move.line` could be easily created with a reserved quantity while the `stock.quant` are not update nor checked. After this commit the operations will be: - The `stock.move` checks the quantity available - The `stock.move` dispatch the available quantity among the `stock.move.line` based on create or write calls. - The `stock.move.line` reserve the quantity on `stock.quant` - If the quantity is bigger than available, we write the max available on `stock.move.line` The idea is to respect the different layers `stock.move` <-> `stock.move.line` <-> `stock.quant`. Avoid the interactions bewteen `stock.move` and `stock.quant` This behavior is already well managed in other use cases. E.g. the real quantity itself, `_do_unreserve` of `stock.move`,... opw - a lot Part-of: odoo/odoo#115328
…
…
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%