details: https://code.openbravo.com/erp/devel/pi/rev/aa5e62559ffb changeset: 26404:aa5e62559ffb user: Jorge Garcia <jorge.garcia <at> openbravo.com> date: Mon Apr 20 18:14:19 2015 +0200 summary: Fixed issue 29571: Book Quantity is not updated to 0 by Update Quantity process
In Physical Inventory Lines, Book Quantity is not updated to 0 by Update Quantity process if product has a mandatory attribute. The decided solution is to delete the lines from the physical inventory in two cases: if the product of the line doesn't had an associated record in the m_storage_detail table, or if the quantity on hand is equal to 0 or the order quantity is equal to 0 or null. details: https://code.openbravo.com/erp/devel/pi/rev/f83615a66bb3 changeset: 26405:f83615a66bb3 user: Unai Martirena <unai.martirena <at> openbravo.com> date: Mon May 04 17:24:03 2015 +0200 summary: Related to bug 29571: Code Review [1]: Fix copyright [2]: Return number of deleted lines diffstat: src-db/database/model/functions/M_INVENTORY_LISTUPDATE.xml | 30 +++++++++++++- 1 files changed, 28 insertions(+), 2 deletions(-) diffs (54 lines): diff -r 2aca706e9b8c -r f83615a66bb3 src-db/database/model/functions/M_INVENTORY_LISTUPDATE.xml --- a/src-db/database/model/functions/M_INVENTORY_LISTUPDATE.xml Mon May 04 13:54:07 2015 +0200 +++ b/src-db/database/model/functions/M_INVENTORY_LISTUPDATE.xml Mon May 04 17:24:03 2015 +0200 @@ -19,7 +19,7 @@ * parts created by ComPiere are Copyright (C) ComPiere, Inc.; * All Rights Reserved. * Contributor(s): Openbravo SLU - * Contributions are Copyright (C) 2001-2008 Openbravo, S.L.U. + * Contributions are Copyright (C) 2001-2015 Openbravo, S.L.U. * * Specifically, this derivative work is based upon the following Compiere * file and version. @@ -100,6 +100,32 @@ */ IF(NOT END_PROCESS) THEN v_ResultStr:='UpdatingLine'; + DELETE FROM M_InventoryLine + WHERE M_Inventory_ID=v_Record_ID + AND (NOT EXISTS + (SELECT * + FROM M_Storage_Detail s + WHERE s.M_Product_ID=M_InventoryLine.M_Product_ID + AND s.M_Locator_ID=M_InventoryLine.M_Locator_ID + AND COALESCE(s.M_ATTRIBUTESETINSTANCE_ID, '0')=COALESCE(M_InventoryLine.M_ATTRIBUTESETINSTANCE_ID, '0') + AND s.C_UOM_ID=M_InventoryLine.C_UOM_ID + AND COALESCE(s.M_Product_UOM_ID, '-1')=COALESCE(M_InventoryLine.M_Product_UOM_ID, '-1') + ) OR EXISTS + (SELECT * + FROM M_Storage_Detail s + WHERE s.M_Product_ID=M_InventoryLine.M_Product_ID + AND s.M_Locator_ID=M_InventoryLine.M_Locator_ID + AND COALESCE(s.M_ATTRIBUTESETINSTANCE_ID, '0')=COALESCE(M_InventoryLine.M_ATTRIBUTESETINSTANCE_ID, '0') + AND s.C_UOM_ID=M_InventoryLine.C_UOM_ID + AND COALESCE(s.M_Product_UOM_ID, '-1')=COALESCE(M_InventoryLine.M_Product_UOM_ID, '-1') + AND s.QTYONHAND = 0 + AND (s.QTYORDERONHAND = 0 OR s.QTYORDERONHAND IS NULL) + )) + ; + rowcount:=SQL%ROWCOUNT; + IF(rowcount<>0) THEN + v_Message:='@Deleted@=' || rowcount || ', '; + END IF; UPDATE M_InventoryLine SET QtyBook= (SELECT QtyOnHand @@ -135,7 +161,7 @@ ) ; rowcount:=SQL%ROWCOUNT; - v_Message:='@Updated@=' || rowcount; + v_Message:=v_Message || '@Updated@=' || rowcount; -- Commented by cromero 19102006 COMMIT; -- Check for products in multiple lines UPDATE M_InventoryLine ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
