details: https://code.openbravo.com/erp/devel/pi/rev/af9e83d05902 changeset: 22017:af9e83d05902 user: Gaurav Deshmukh <gaurav.deshmukh <at> openbravo.com> date: Thu Jan 30 11:29:06 2014 +0530 summary: Fixes Issue 25174: Goods shipment can be booked without product and quantity.
details: https://code.openbravo.com/erp/devel/pi/rev/12b3d243b293 changeset: 22018:12b3d243b293 user: Gaurav Deshmukh <gaurav.deshmukh <at> openbravo.com> date: Wed Feb 05 15:01:07 2014 +0530 summary: Fixes Issue 25532: Price list creation is not working fine diffstat: src-db/database/model/functions/M_INOUT_POST.xml | 21 +++++++++++++- src-db/database/model/functions/M_PRICELIST_CREATE.xml | 12 ++++---- src-db/database/sourcedata/AD_COLUMN.xml | 2 +- src-db/database/sourcedata/AD_MESSAGE.xml | 12 ++++++++ src/org/openbravo/event/MInOutLineEventHandler.java | 27 +++++++++++++++++- 5 files changed, 65 insertions(+), 9 deletions(-) diffs (165 lines): diff -r 99858c127329 -r 12b3d243b293 src-db/database/model/functions/M_INOUT_POST.xml --- a/src-db/database/model/functions/M_INOUT_POST.xml Thu Feb 13 17:23:11 2014 +0100 +++ b/src-db/database/model/functions/M_INOUT_POST.xml Wed Feb 05 15:01:07 2014 +0530 @@ -68,6 +68,7 @@ Cur_InOutLine RECORD; Cur_Order RECORD; Cur_OrderLine RECORD; + Cur_Lines RECORD; -- v_Result NUMBER:=1; v_AD_Org_ID VARCHAR2(32); @@ -179,13 +180,31 @@ RAISE_APPLICATION_ERROR(-20000, '@NotCorrectOrgBpartnerInout@') ; END IF; END IF; - + Declare + v_Message_product VARCHAR(2000) :=''; + Begin + FOR Cur_Lines IN ( + SELECT M.line + FROM M_InOut I, + M_InOutLine M + WHERE I.M_InOut_ID=M.M_InOut_ID + AND I.M_INOUT_ID=v_Record_ID + AND (M.M_PRODUCT_ID IS NULL AND M.MOVEMENTQTY <> 0) + ORDER BY M.line + ) LOOP + v_Message_product:=v_Message_product||Cur_Lines.line||', '; + END LOOP; + if v_Message_product != '' then + RAISE_APPLICATION_ERROR(-20000, '@Inline@ '||v_Message_product||' '||'@ProductNullAndMovementQtyGreaterZero@') ; + end if ; + End ; if(v_isreturndoctype = 'N' AND v_isSoTrx = 'Y' and v_DocAction<>'RC') then v_message := null; for Cur_OrderLine in ( select c_orderline_id, line from m_inoutline where m_inout_id = v_Record_ID + and c_orderline_id is not null order by line ) loop select COALESCE(sum(movementqty), 0) diff -r 99858c127329 -r 12b3d243b293 src-db/database/model/functions/M_PRICELIST_CREATE.xml --- a/src-db/database/model/functions/M_PRICELIST_CREATE.xml Thu Feb 13 17:23:11 2014 +0100 +++ b/src-db/database/model/functions/M_PRICELIST_CREATE.xml Wed Feb 05 15:01:07 2014 +0530 @@ -516,18 +516,18 @@ ; ELSE UPDATE M_ProductPrice - SET PriceList=( + SET PriceList=ROUND(( CASE Cur_DiscountLine.List_Base WHEN 'C' THEN PriceList*(1+Cur_DiscountLine.LIST_MARGIN/100) ELSE PriceList END - ), - PriceStd=( + ), v_StdPrecision), + PriceStd=ROUND(( CASE Cur_DiscountLine.Std_Base WHEN 'C' THEN PriceStd*(1+Cur_DiscountLine.STD_MARGIN/100) ELSE PriceStd END - ), - PriceLimit=( + ), v_StdPrecision), + PriceLimit=ROUND(( CASE Cur_DiscountLine.Limit_Base WHEN 'C' THEN PriceLimit*(1+Cur_DiscountLine.LIMIT_MARGIN/100) ELSE PriceLimit END - ), + ), v_StdPrecision), updated=now() WHERE M_PriceList_Version_ID=v_PriceList_Version_ID AND EXISTS diff -r 99858c127329 -r 12b3d243b293 src-db/database/sourcedata/AD_COLUMN.xml --- a/src-db/database/sourcedata/AD_COLUMN.xml Thu Feb 13 17:23:11 2014 +0100 +++ b/src-db/database/sourcedata/AD_COLUMN.xml Wed Feb 05 15:01:07 2014 +0530 @@ -56553,7 +56553,7 @@ <!--3540--> <AD_TABLE_ID><![CDATA[320]]></AD_TABLE_ID> <!--3540--> <AD_REFERENCE_ID><![CDATA[29]]></AD_REFERENCE_ID> <!--3540--> <FIELDLENGTH><![CDATA[10]]></FIELDLENGTH> -<!--3540--> <DEFAULTVALUE><![CDATA[1]]></DEFAULTVALUE> +<!--3540--> <DEFAULTVALUE><![CDATA[0]]></DEFAULTVALUE> <!--3540--> <ISKEY><![CDATA[N]]></ISKEY> <!--3540--> <ISPARENT><![CDATA[N]]></ISPARENT> <!--3540--> <ISMANDATORY><![CDATA[Y]]></ISMANDATORY> diff -r 99858c127329 -r 12b3d243b293 src-db/database/sourcedata/AD_MESSAGE.xml --- a/src-db/database/sourcedata/AD_MESSAGE.xml Thu Feb 13 17:23:11 2014 +0100 +++ b/src-db/database/sourcedata/AD_MESSAGE.xml Wed Feb 05 15:01:07 2014 +0530 @@ -24858,6 +24858,18 @@ <!--F38A8843E6504699A91571A79C3AA3DF--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N> <!--F38A8843E6504699A91571A79C3AA3DF--></AD_MESSAGE> +<!--F3D93965FE2A4900A9F4358458D5C065--><AD_MESSAGE> +<!--F3D93965FE2A4900A9F4358458D5C065--> <AD_MESSAGE_ID><![CDATA[F3D93965FE2A4900A9F4358458D5C065]]></AD_MESSAGE_ID> +<!--F3D93965FE2A4900A9F4358458D5C065--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> +<!--F3D93965FE2A4900A9F4358458D5C065--> <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID> +<!--F3D93965FE2A4900A9F4358458D5C065--> <ISACTIVE><![CDATA[Y]]></ISACTIVE> +<!--F3D93965FE2A4900A9F4358458D5C065--> <VALUE><![CDATA[ProductNullAndMovementQtyGreaterZero]]></VALUE> +<!--F3D93965FE2A4900A9F4358458D5C065--> <MSGTEXT><![CDATA[When Product is blank then Movement Quantity must be zero.]]></MSGTEXT> +<!--F3D93965FE2A4900A9F4358458D5C065--> <MSGTYPE><![CDATA[E]]></MSGTYPE> +<!--F3D93965FE2A4900A9F4358458D5C065--> <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID> +<!--F3D93965FE2A4900A9F4358458D5C065--> <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N> +<!--F3D93965FE2A4900A9F4358458D5C065--></AD_MESSAGE> + <!--F4944007131447B6ADF3903564B478E6--><AD_MESSAGE> <!--F4944007131447B6ADF3903564B478E6--> <AD_MESSAGE_ID><![CDATA[F4944007131447B6ADF3903564B478E6]]></AD_MESSAGE_ID> <!--F4944007131447B6ADF3903564B478E6--> <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID> diff -r 99858c127329 -r 12b3d243b293 src/org/openbravo/event/MInOutLineEventHandler.java --- a/src/org/openbravo/event/MInOutLineEventHandler.java Thu Feb 13 17:23:11 2014 +0100 +++ b/src/org/openbravo/event/MInOutLineEventHandler.java Wed Feb 05 15:01:07 2014 +0530 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2013 Openbravo SLU + * All portions are Copyright (C) 2013-2014 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************* @@ -22,14 +22,18 @@ import org.apache.log4j.Logger; import org.hibernate.criterion.Restrictions; +import org.openbravo.base.exception.OBException; import org.openbravo.base.model.Entity; import org.openbravo.base.model.ModelProvider; import org.openbravo.client.kernel.event.EntityDeleteEvent; +import org.openbravo.client.kernel.event.EntityNewEvent; import org.openbravo.client.kernel.event.EntityPersistenceEventObserver; +import org.openbravo.client.kernel.event.EntityUpdateEvent; import org.openbravo.dal.core.OBContext; import org.openbravo.dal.service.OBCriteria; import org.openbravo.dal.service.OBDal; import org.openbravo.database.ConnectionProvider; +import org.openbravo.erpCommon.utility.OBMessageUtils; import org.openbravo.model.materialmgmt.transaction.ShipmentInOut; import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine; import org.openbravo.service.db.DalConnectionProvider; @@ -44,6 +48,27 @@ return entities; } + public void onSave(@Observes EntityNewEvent event) { + if (!isValidEvent(event)) { + return; + } + ShipmentInOutLine shipmentInOutLine = (ShipmentInOutLine) event.getTargetInstance(); + + if (shipmentInOutLine.getProduct() == null && (shipmentInOutLine.getMovementQuantity().doubleValue() != 0) ){ + throw new OBException(OBMessageUtils.messageBD("ProductNullAndMovementQtyGreaterZero")); + } + } + + public void onUpdate(@Observes EntityUpdateEvent event) { + if (!isValidEvent(event)) { + return; + } + ShipmentInOutLine shipmentInOutLine = (ShipmentInOutLine) event.getTargetInstance(); + + if (shipmentInOutLine.getProduct()== null && (shipmentInOutLine.getMovementQuantity().doubleValue() != 0)){ + throw new OBException(OBMessageUtils.messageBD("ProductNullAndMovementQtyGreaterZero")); + } +} public void onDelete(@Observes EntityDeleteEvent event) { if (!isValidEvent(event)) { return; ------------------------------------------------------------------------------ Android apps run on BlackBerry 10 Introducing the new BlackBerry 10.2.1 Runtime for Android apps. Now with support for Jelly Bean, Bluetooth, Mapview and more. Get your Android app in front of a whole new audience. Start now. http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk _______________________________________________ Openbravo-commits mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbravo-commits
