Name: [FIX] stock: soft correct unsynch between quant and stock.move.line

State: Killed

PR State: merged

PR Author: Roy Le

PR Author Email:

PR: #1231

Committer: Roy Le

Committer Email: roy.le@viindoo.com

Commit: db8cad3505669e3e7f8ab97ced80a59085a582aa

Description:

                                            [FIX] stock: soft correct unsynch between quant and stock.move.line

It happens due to many reasons that the `stock.quant` object and
`stock.move.line` loose their synchronisation and it could have a
difference between the sum of `stock.move.line` and the quantity/reserved
quantity on the `stock.quant`

It's important to keep tracking why the desycnh happens and to fix all
the root causes of it.

However, it's hard for the user to clean the data himself or even worst
to lock him when it happens (as before 18.0).

For quantity: It's not a big deal to have a huge difference between the
quantity and all the long time history. As in real life, the inventory
adjustement can help to clean the data.

For reserved quantity: It's a bigger problem since the user can't edit
it. A first step would be to never write it to a negative value (since
it should never happen). That way when the user empty the stock, it will
also probably clean the reserved quantity. But in case where there is
more reservation than on `stock.move.line`. We should also clean it to
be able to reserve them. Currently, we will try in the scheduler for
that part

A last step, could be to create a constraint during test that ensure
the synch is never broken and it could raise directly if the developer
made a mistake

closes odoo/odoo#188201

Signed-off-by: William Henrotin (whe) <whe@odoo.com>
                                            

Branch: 17.0

Instance ID: 0

Age:

Up-time: Not finished

Subbuilds Name State Detail
Build 386090 At install tests: from account to website_twitter Killed Log
Build 386091 Post install tests: step install all modules Killed Log
Build 386092 Post install tests: from account to payment_adyen Killed
Build 386093 Post install tests: from payment_alipay to test_viin_approval Killed
Build 386094 Post install tests: from test_viin_mail_route to to_warranty_sale_stock Killed
Build 386095 Post install tests: from to_warranty_stock to viin_features_activate_contacts Killed
Build 386096 Post install tests: from viin_features_activate_freight to viin_project_scrum_helpdesk Killed
Build 386097 Post install tests: from viin_project_timesheet_leave to website_twitter Killed
Create Date Level Message
06/17/2026 17:05:52 INFO
Updated repository Viindoo-tvtmaaddons
06/17/2026 17:05:52 INFO
Updated repository Viindoo-erponline-enterprise
06/17/2026 17:05:52 INFO
Updated repository Viindoo-branding
06/17/2026 17:05:52 INFO
Cloned repository Viindoo-odoo