details: https://code.openbravo.com/erp/devel/pi/rev/dc3d9d26aeb4 changeset: 34299:dc3d9d26aeb4 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Fri Jul 13 11:57:27 2018 +0530 summary: Fixes Issue 38799:More quantity reserved than available after booking a reopened sales order with more ordered quantity
** When ordered qty is greater than already reserved quantity then v_pendingtounreserve needs to be considered as ZERO instead of negative value as it exceeds the reserved qty than the available qty. diffstat: src-db/database/model/functions/C_ORDER_POST1.xml | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diffs (22 lines): diff -r 326f3d73a55e -r dc3d9d26aeb4 src-db/database/model/functions/C_ORDER_POST1.xml --- a/src-db/database/model/functions/C_ORDER_POST1.xml Fri Jul 13 23:50:48 2018 +0530 +++ b/src-db/database/model/functions/C_ORDER_POST1.xml Fri Jul 13 11:57:27 2018 +0530 @@ -1374,6 +1374,9 @@ IF (cur_orderline.qtyordered < v_reservedqty) OR (v_releasedqty = 0 AND cur_orderline.qtyordered > 0) THEN --Reservation quantity to decrease with more reserved quantity than new quantity, unreserve stock v_pendingtounreserve := v_reservedqty - cur_orderline.qtyordered; + IF(v_pendingtounreserve < 0) THEN + v_pendingtounreserve := 0; + END IF; FOR cur_res_stock IN ( SELECT m_reservation_stock_id, quantity - COALESCE(releasedqty, 0) AS reservedqty FROM m_reservation_stock @@ -1416,7 +1419,7 @@ updated = now(), updatedby = v_user WHERE m_reservation_id = v_reservation_id; - IF (v_quantity < cur_orderline.qtyordered AND v_res_status = 'CO' AND v_DocAction <> 'CO') THEN + IF (v_quantity < cur_orderline.qtyordered AND v_res_status = 'CO') THEN --Reservation processed with higher quantity. Try to reserve the new quantity. M_RESERVE_STOCK_AUTO(v_reservation_id, v_user, v_reservedqty); END IF; ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits