diff options
| author | William Henrotin <whe@odoo.com> | 2019-12-19 09:14:28 +0000 |
|---|---|---|
| committer | William Henrotin <whe@odoo.com> | 2019-12-19 09:52:56 +0000 |
| commit | bd80ea51d736ba3345791724a60c2fa966861f39 (patch) | |
| tree | fd76d669d4729d814fea4799bf07b49afc24b0d3 | |
| parent | 6b751f12f394ef0325d606080f184fbedc5f9f3a (diff) | |
[FIX] stock: free_reservation performance
Validating a move line will remove the reservation on other move line
that will take quantity on the same quant.
The querry searching for those move lines needs the state of their
relative stock move to be neither 'done' nor 'cancel'. This constraint
add a join in the SQL querry that slow largely the request
This commit removes the `move` state in the querry and replace it by the
the move line state to speed it up.
Thanks to
https://github.com/odoo/odoo/commit/39b65efbad36a0b63de5d148bc575eaf15b60653
and
https://github.com/odoo/odoo/commit/23e77b80336514d07504c35d717d4573bed90071,
it's will give the same result as the
move line state is related stored of its relative move.
opw 2126433
closes odoo/odoo#42170
X-original-commit: dbc664e5d5f28d6fdd8f791ee349a842fd7d22d0
Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
| -rw-r--r-- | addons/stock/models/stock_move_line.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index 86c40f6e75c..1b944b2714b 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -531,7 +531,7 @@ class StockMoveLine(models.Model): # We now have to find the move lines that reserved our now unavailable quantity. We # take care to exclude ourselves and the move lines were work had already been done. outdated_move_lines_domain = [ - ('move_id.state', 'not in', ['done', 'cancel']), + ('state', 'not in', ['done', 'cancel']), ('product_id', '=', product_id.id), ('lot_id', '=', lot_id.id if lot_id else False), ('location_id', '=', location_id.id), |
