details:   https://code.openbravo.com/erp/devel/pi/rev/edb969df8c3f
changeset: 31752:edb969df8c3f
user:      Armaignac <collazoandy4 <at> gmail.com>
date:      Tue Mar 28 12:37:35 2017 -0400
summary:   Fixes issue 35270: Wrong Sales Order reservation with a voided 
partial shipment

When closing a Sales Order with a reservation that contains a voided partial 
shipment
The reservation created in the shipment voiding process was keeping associated
to the Sales Order. Also in the Stock Reservation window the Manage Stock button
is show in a reservation with close status.

Now the reservation stock created in the voiding process of the Shipment is 
deleted
in the close process of the order, also the reservation stock qty = releasedqty
if the order line orderedqty is greater than reservation releasedqty

The display logic of the Manage Stock button now check the selected reservation
status.

details:   https://code.openbravo.com/erp/devel/pi/rev/aba5b34b8ad7
changeset: 31753:aba5b34b8ad7
user:      Alvaro Ferraz <alvaro.ferraz <at> openbravo.com>
date:      Wed Mar 29 12:10:01 2017 +0200
summary:   Related to issue 35270: Code review improvements

Update related reservation quantity with order line delivered quantity when 
closing the order.

diffstat:

 src-db/database/model/functions/C_ORDER_POST1.xml |  15 +++++++++++----
 src-db/database/sourcedata/AD_FIELD.xml           |   2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)

diffs (47 lines):

diff -r e10bc2fc5f83 -r aba5b34b8ad7 
src-db/database/model/functions/C_ORDER_POST1.xml
--- a/src-db/database/model/functions/C_ORDER_POST1.xml Tue Mar 28 17:55:09 
2017 +0200
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml Wed Mar 29 12:10:01 
2017 +0200
@@ -1291,7 +1291,7 @@
                   IF (cur_orderline.qtyordered < v_releasedqty) THEN
                     RAISE_APPLICATION_ERROR(-20000, 
'@CannotOrderLessThanReleasedQty@');
                   END IF;
-                  IF (cur_orderline.qtyordered < v_reservedqty) THEN
+                  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;
                     FOR cur_res_stock IN (
@@ -1315,12 +1315,19 @@
                     IF (v_pendingtounreserve > 0) THEN
                       RAISE_APPLICATION_ERROR(-20000, 
'@CouldNotUnreserveNeededQty@');
                     END IF;
-                    -- Delete reservation lines with quantity zero.
+                    -- Delete reservation lines with zero releasedqty
                     DELETE FROM m_reservation_stock
-                    WHERE quantity = 0
-                      AND COALESCE(releasedqty, 0) = 0
+                    WHERE COALESCE(releasedqty, 0) = 0
                       AND m_reservation_id = v_reservation_id;
                   END IF;
+                  -- Order line orderedqty greater than reservation releasedqty
+                  IF (cur_orderline.qtyordered > v_releasedqty) THEN
+                    UPDATE m_reservation_stock
+                    SET quantity = releasedqty,
+                        updated = now(),
+                        updatedby = v_user
+                    WHERE m_reservation_id = v_reservation_id;
+                  END IF;
                   UPDATE m_reservation
                   SET quantity = cur_orderline.qtyordered,
                       res_status = 'CL',
diff -r e10bc2fc5f83 -r aba5b34b8ad7 src-db/database/sourcedata/AD_FIELD.xml
--- a/src-db/database/sourcedata/AD_FIELD.xml   Tue Mar 28 17:55:09 2017 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml   Wed Mar 29 12:10:01 2017 +0200
@@ -192735,7 +192735,7 @@
 <!--244ECD2DC27B4939BF9B89F44732E3DE-->  
<AD_COLUMN_ID><![CDATA[CD35A6659453BC17E040007F010017DB]]></AD_COLUMN_ID>
 <!--244ECD2DC27B4939BF9B89F44732E3DE-->  
<IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
 <!--244ECD2DC27B4939BF9B89F44732E3DE-->  
<ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--244ECD2DC27B4939BF9B89F44732E3DE-->  
<DISPLAYLOGIC><![CDATA[@quantity@!@releasedqty@]]></DISPLAYLOGIC>
+<!--244ECD2DC27B4939BF9B89F44732E3DE-->  
<DISPLAYLOGIC><![CDATA[@quantity@!@releasedqty@&@RES_Status@!'CL']]></DISPLAYLOGIC>
 <!--244ECD2DC27B4939BF9B89F44732E3DE-->  
<DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--244ECD2DC27B4939BF9B89F44732E3DE-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--244ECD2DC27B4939BF9B89F44732E3DE-->  <SEQNO><![CDATA[140]]></SEQNO>

------------------------------------------------------------------------------
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

Reply via email to