Commit Graph

2 Commits

Author SHA1 Message Date
Laurent Mignon (ACSONE)
eb3066af90 [MIG] stock_move_auto_assign: Migration to 16.0 2022-11-03 15:16:30 +01:00
Guewen Baconnier
e32fefa078 Fix concurrency race condition on picking state
When the 2 last moves of a stock.picking are assigned at the same
time by 2 jobs (different products both available), none of the
transaction will see that it is the last move to be assigned. As a
result, the picking will stay in state "confirmed" even if all its
moves are assigned.

Lock the stock.picking records when we call auto_assign.
If we have many pickings touched for the same product, the lock
can be quite large, so we may have to find a better option.

I could not write a test to exercise this, because we can't have 2
transactions being aware of it, even if we create the picking in demo
data as tests can be run during install.
2022-11-03 15:07:32 +01:00