details: https://code.openbravo.com/erp/devel/pi/rev/9103f1b1f506 changeset: 35450:9103f1b1f506 user: Atul Gaware <atul.gaware <at> openbravo.com> date: Wed Jan 30 11:29:47 2019 +0530 summary: Fixes Issue 0040049: Create Shipments from Orders is consuming Document Sequence although the shipment is not created because there is not stock
While creating shipment header, get document no but do not increment the document sequence, before processing shipment get document no and increment document sequence. So whenever there is condition that shipment cannot be created, document sequence is not incremented unless shipment is eligible for processing. diffstat: src-db/database/model/functions/M_INOUT_CREATE.xml | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diffs (39 lines): diff -r b32c4494df35 -r 9103f1b1f506 src-db/database/model/functions/M_INOUT_CREATE.xml --- a/src-db/database/model/functions/M_INOUT_CREATE.xml Thu Feb 14 12:05:41 2019 +0100 +++ b/src-db/database/model/functions/M_INOUT_CREATE.xml Wed Jan 30 11:29:47 2019 +0530 @@ -34,7 +34,7 @@ * parts created by ComPiere are Copyright (C) ComPiere, Inc.; * All Rights Reserved. * Contributor(s): Openbravo SLU - * Contributions are Copyright (C) 2001-2018 Openbravo, S.L.U. + * Contributions are Copyright (C) 2001-2019 Openbravo, S.L.U. * * Specifically, this derivative work is based upon the following Compiere * file and version. @@ -371,9 +371,9 @@ SELECT C_DocTypeShipment_ID INTO v_DocType_ID FROM C_DOCTYPE WHERE C_DocType_ID=Cur_Order.C_DocType_ID; - Ad_Sequence_Doctype(v_DocType_ID, Cur_Order.C_Order_ID, 'Y', v_DocumentNo) ; + Ad_Sequence_Doctype(v_DocType_ID, Cur_Order.C_Order_ID, 'N', v_DocumentNo) ; IF (v_DocumentNo IS NULL) THEN - Ad_Sequence_Doc('DocumentNo_M_InOut', Cur_Order.AD_Client_ID, 'Y', v_DocumentNo) ; + Ad_Sequence_Doc('DocumentNo_M_InOut', Cur_Order.AD_Client_ID, 'N', v_DocumentNo) ; END IF; IF (Cur_Order.DocSubTypeSO IN ('WR','WP')) THEN @@ -861,6 +861,14 @@ END IF; IF (v_PostResult IS NULL) THEN + Ad_Sequence_Doctype(v_DocType_ID, Cur_Order.C_Order_ID, 'Y', v_DocumentNo) ; + IF (v_DocumentNo IS NULL) THEN + Ad_Sequence_Doc('DocumentNo_M_InOut', Cur_Order.AD_Client_ID, 'Y', v_DocumentNo) ; + END IF; + UPDATE M_InOut SET DocumentNo = v_DocumentNo, + Updated = now(), + UpdatedBy = v_User_ID + WHERE M_InOut_ID = p_InOut_ID; -- Post Shipment M_INOUT_POST(NULL, p_InOut_ID) ; END IF; _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits