-
- Downloads
[FIX] stock: do not allow direct deletion of quants
Some users were updating their access rights to allow for direct deletion of quants. This could lead to the infamous: "It is not possible to unreserve more products of %s than you have in stock." error since directly deleting a quant bypasses the flows of correctly unreserving the amounts you are deleting. Therefore we now restrict the unlinking to: - when in sudo mode, since the automatic unlinking of zero quants always occurs in sudo mode. - stock manager when unlink access right = True. Normally we would allow any user with the unlink access to do it, but since we are using the existing `_apply_inventory` to ensure that reserved qtys of the quant are correctly unreserved before the unlinking, only stock managers will correctly do this unreservation. It is expected that some custom code may break due to this restriction, but if custom code is directly unlinking quants without a sudo or with a non-stock manager, then the code in these cases probably need to be fixed anyways since this will cause inconsistent db data and lead to the error above. closes odoo/odoo#114991 Signed-off-by:Arnold Moyaux (arm) <arm@odoo.com> Signed-off-by:
Tiffany Chang <tic@odoo.com>
Loading