Fixed bug 23541 It is not allow negative quantities in BOMProducts
authorSandra Huguet <sandra.huguet@openbravo.com>
Tue, 28 May 2013 17:40:59 +0200
changeset 20491 861974c450d8
parent 20490 f6a4fd1a4a26
child 20492 80ca7ee3ac68
Fixed bug 23541 It is not allow negative quantities in BOMProducts
src-db/database/sourcedata/AD_MESSAGE.xml
src/org/openbravo/erpCommon/ad_process/VerifyBOM.java
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Wed May 29 12:16:05 2013 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Tue May 28 17:40:59 2013 +0200
@@ -21409,6 +21409,18 @@
 <!--A007BE413E154F23B3CAA4BA40153736-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--A007BE413E154F23B3CAA4BA40153736--></AD_MESSAGE>
 
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9--><AD_MESSAGE>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <AD_MESSAGE_ID><![CDATA[A01BC7E3D1804395A64CD6C78B4EE4A9]]></AD_MESSAGE_ID>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <VALUE><![CDATA[BOM_NegativeQty]]></VALUE>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <MSGTEXT><![CDATA[It is not allowed to insert negative quantities in BOM Products]]></MSGTEXT>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--A01BC7E3D1804395A64CD6C78B4EE4A9--></AD_MESSAGE>
+
 <!--A028CFDE75274327BF364041696938AE--><AD_MESSAGE>
 <!--A028CFDE75274327BF364041696938AE-->  <AD_MESSAGE_ID><![CDATA[A028CFDE75274327BF364041696938AE]]></AD_MESSAGE_ID>
 <!--A028CFDE75274327BF364041696938AE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/erpCommon/ad_process/VerifyBOM.java	Wed May 29 12:16:05 2013 +0200
+++ b/src/org/openbravo/erpCommon/ad_process/VerifyBOM.java	Tue May 28 17:40:59 2013 +0200
@@ -56,6 +56,13 @@
             OBContext.getOBContext().getLanguage().getLanguage()));
       }
 
+      for (ProductBOM productBom : productBOMList) {
+        if (productBom.getBOMQuantity().floatValue() < 0) {
+          throw new Exception(Utility.messageBD(new DalConnectionProvider(), "BOM_NegativeQty",
+              OBContext.getOBContext().getLanguage().getLanguage()));
+        }
+      }
+
       boolean cycle = checkForcycles(productList, productBOMList);
 
       if (cycle) {