details: https://code.openbravo.com/erp/devel/pi/rev/bd98803e01b5 changeset: 31780:bd98803e01b5 user: Armaignac <collazoandy4 <at> gmail.com> date: Fri Mar 31 13:58:32 2017 -0400 summary: Fixes issue 34805: Operative quantity should be updated when document is closed
When a Purchase Order/Return From Customer/Return to Vendor document is closed, the Operative Quantity field is updated to the corresponding value, according to the Product, Quantity and Aum of the line. diffstat: src-db/database/model/functions/C_ORDER_POST1.xml | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diffs (43 lines): diff -r 1f63d7f9e061 -r bd98803e01b5 src-db/database/model/functions/C_ORDER_POST1.xml --- a/src-db/database/model/functions/C_ORDER_POST1.xml Thu Mar 30 18:46:58 2017 +0200 +++ b/src-db/database/model/functions/C_ORDER_POST1.xml Fri Mar 31 13:58:32 2017 -0400 @@ -677,6 +677,7 @@ DECLARE Cur_Inventory RECORD; v_QtyOrdered NUMBER; + v_QtyAum NUMBER; v_QuantityOrder NUMBER; v_linenetamt NUMBER; v_linegrossamt NUMBER; @@ -710,6 +711,7 @@ ) LOOP v_QtyOrdered := CASE WHEN (Cur_Inventory.QtyDelivered < 0) THEN LEAST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) ELSE GREATEST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) END; + v_QtyAum := M_GET_CONVERTED_AUMQTY(Cur_Inventory.M_Product_ID, v_QtyOrdered, Cur_Inventory.C_AUM); v_linenetamt := ROUND(v_QtyOrdered * Cur_Inventory.priceactual, C_GET_CURRENCY_PRECISION(Cur_Inventory.C_Currency_ID, 'A')); v_linegrossamt := ROUND(v_QtyOrdered * Cur_Inventory.gross_unit_price, C_GET_CURRENCY_PRECISION(Cur_Inventory.C_Currency_ID, 'A')); SELECT MAX(UOM.C_UOM_ID) @@ -728,6 +730,7 @@ -- UPDATE C_ORDERLINE UPDATE C_ORDERLINE SET QtyOrdered=v_QtyOrdered, + AumQty = v_QtyAum, linenetamt=v_linenetamt, line_gross_amount=v_linegrossamt, QuantityOrder=v_QuantityOrder, @@ -775,6 +778,7 @@ ) LOOP v_QtyOrdered := COALESCE(CASE WHEN (Cur_Inventory.QtyDelivered < 0) THEN LEAST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) ELSE GREATEST(Cur_Inventory.QtyDelivered, Cur_Inventory.QtyInvoiced) END, 0); + v_QtyAum := M_GET_CONVERTED_AUMQTY(Cur_Inventory.M_Product_ID, v_QtyOrdered, Cur_Inventory.C_AUM); v_linenetamt := ROUND(COALESCE(v_QtyOrdered, 0) * Cur_Inventory.priceactual, C_GET_CURRENCY_PRECISION(Cur_Inventory.C_Currency_ID, 'A')); v_linegrossamt := ROUND(COALESCE(v_QtyOrdered, 0) * Cur_Inventory.gross_unit_price, C_GET_CURRENCY_PRECISION(Cur_Inventory.C_Currency_ID, 'A')); @@ -793,6 +797,7 @@ -- UPDATE C_ORDERLINE UPDATE C_ORDERLINE SET QtyOrdered=v_QtyOrdered, + AumQty = v_QtyAum, linenetamt=v_linenetamt, line_gross_amount=v_linegrossamt, QuantityOrder=v_QuantityOrder, ------------------------------------------------------------------------------ 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