Backouts 8fff038cc32e rev. Multiple files pushed by mistake
authorEduardo Argal Guibert <eduardo.argal@openbravo.com>
Wed, 03 Jun 2015 12:49:03 +0200
changeset 26869 bb6958d2bb8d
parent 26868 5ca1fcef07ed
child 26870 2493e548545e
child 26875 084e25f8f2cd
Backouts 8fff038cc32e rev. Multiple files pushed by mistake
modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/model/functions/C_ORDER_POST1.xml
src-db/database/model/triggers/M_TRANSACTION_TRG2.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-test/src/org/openbravo/test/accounting/PostDocumentTest.java
src/org/openbravo/costing/LandedCostProcess.java
src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java
src/org/openbravo/event/CharacteristicValueEventHandler.java
src/org/openbravo/financial/ResetAccounting.java
--- a/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml	Tue Jun 02 13:25:52 2015 +0530
+++ b/modules/org.openbravo.advpaymentmngt/src-db/database/sourcedata/AD_COLUMN.xml	Wed Jun 03 12:49:03 2015 +0200
@@ -6427,42 +6427,6 @@
 <!--91BC2133F04647938F702192A5156C25-->  <SQLLOGIC><![CDATA[(SELECT count(*) FROM fin_finacc_transaction t,  fin_reconciliation rec WHERE (t.fin_reconciliation_id IS NULL OR (EXISTS ( SELECT 1 FROM fin_reconciliation r WHERE r.dateto > rec.dateto AND t.fin_reconciliation_id  = r.fin_reconciliation_id ))) AND t.statementdate <= rec.dateto AND t.paymentamt <> 0 AND t.fin_financial_account_id  = rec.fin_financial_account_id AND rec.fin_reconciliation_id = fin_reconciliation_id) ]]></SQLLOGIC>
 <!--91BC2133F04647938F702192A5156C25--></AD_COLUMN>
 
-<!--9220C8010FFB4EAABB8B367633EA9454--><AD_COLUMN>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <AD_COLUMN_ID><![CDATA[9220C8010FFB4EAABB8B367633EA9454]]></AD_COLUMN_ID>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <NAME><![CDATA[Client]]></NAME>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <COLUMNNAME><![CDATA[AD_Client_ID]]></COLUMNNAME>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <AD_TABLE_ID><![CDATA[FF808081331848750133184B38D20009]]></AD_TABLE_ID>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <DEFAULTVALUE><![CDATA[@AD_CLIENT_ID@]]></DEFAULTVALUE>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISKEY><![CDATA[N]]></ISKEY>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISPARENT><![CDATA[N]]></ISPARENT>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <SEQNO><![CDATA[60]]></SEQNO>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <AD_ELEMENT_ID><![CDATA[102]]></AD_ELEMENT_ID>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <AD_MODULE_ID><![CDATA[A918E3331C404B889D69AA9BFAFB23AC]]></AD_MODULE_ID>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <POSITION><![CDATA[6]]></POSITION>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
-<!--9220C8010FFB4EAABB8B367633EA9454-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
-<!--9220C8010FFB4EAABB8B367633EA9454--></AD_COLUMN>
-
 <!--923F5B228E5F4D2D96C00C206D47BC63--><AD_COLUMN>
 <!--923F5B228E5F4D2D96C00C206D47BC63-->  <AD_COLUMN_ID><![CDATA[923F5B228E5F4D2D96C00C206D47BC63]]></AD_COLUMN_ID>
 <!--923F5B228E5F4D2D96C00C206D47BC63-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/model/functions/C_ORDER_POST1.xml	Tue Jun 02 13:25:52 2015 +0530
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml	Wed Jun 03 12:49:03 2015 +0200
@@ -127,8 +127,6 @@
   v_iscashvat C_Order.IsCashVat%TYPE;
   v_recalculateDiscounts VARCHAR(1):='Y';
   v_isactive VARCHAR2(1):='N';
-  
-  v_has_M_InOut VARCHAR2(1) := 'N';
 
   BEGIN
     IF (p_PInstance_ID IS NOT NULL) THEN
@@ -417,23 +415,6 @@
         IF (v_DocSubTypeSO IN ('WR', 'WI')) THEN
           RAISE_APPLICATION_ERROR(-20000, '@ActionNotSupported@');
         END IF;
-        
-        --Verify that have not Goods Receipt related
-        select case when count(iol.m_inoutline_id) > 0 then 'Y' else 'N' end
-        into v_has_M_InOut
-        from m_inoutline iol
-        where exists (select 1 from c_orderline ol 
-          where iol.c_orderline_id = ol.c_orderline_id
-          and ol.c_order_id = v_record_id);
-        
-        if (v_has_M_InOut = 'Y') then
-          if (v_issotrx = 'N') then
-            RAISE_APPLICATION_ERROR(-20000, '@OrderReactivateHasGoodsReceipt@');
-          else
-            RAISE_APPLICATION_ERROR(-20000, '@OrderReactivateHasGoodsShipment@');
-          end if;
-        end if;
-        
         --Verify not managed debtPayments added by ALO
         --Added by P.Sarobe. New messages
         SELECT max(c_debt_payment_id), COUNT(*)
--- a/src-db/database/model/triggers/M_TRANSACTION_TRG2.xml	Tue Jun 02 13:25:52 2015 +0530
+++ b/src-db/database/model/triggers/M_TRANSACTION_TRG2.xml	Wed Jun 03 12:49:03 2015 +0200
@@ -15,65 +15,92 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2012-2014 Openbravo SLU
+* All portions are Copyright (C) 2012-2013 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
-  v_onhand NUMBER:=0;
-  v_reserved NUMBER:=0;
+  v_onhand      NUMBER;
+  v_reserved    NUMBER;
   v_count       NUMBER;
+  v_productname m_product.name%TYPE;
   v_isgeneric   CHAR(1);
+  v_product     VARCHAR(60);
   v_attr_description    VARCHAR2(255);
   v_product_value       VARCHAR2(40);
   v_locator_value       VARCHAR2(40);
   v_uom_value           VARCHAR2(3);
-  cur_reserve_stock RECORD;
 
 BEGIN
   IF (AD_isTriggerEnabled() = 'N') THEN RETURN;
   END IF;
 
   IF (INSERTING) THEN
-    SELECT isgeneric, value INTO v_isgeneric, v_product_value
-    FROM m_product
-    WHERE m_product_id = :NEW.m_product_id;
-    IF (v_isgeneric = 'Y') THEN
-      RAISE_APPLICATION_ERROR(-20000, '@CannotUseGenericProduct@');
-    END IF;
-    FOR cur_reserve_stock IN (
-        SELECT COALESCE(sum(rs.quantity - COALESCE(rs.releasedqty,0)), 0) AS reservedQty, sd.qtyonhand
+    IF (:NEW.movementqty < 0 AND :NEW.m_product_uom_id IS NULL) THEN
+      -- Check reservations. Reserved stock must be released before inserting the transacion.
+      SELECT count(1) INTO v_count
+      FROM dual
+      WHERE EXISTS (SELECT 1
+                    FROM m_reservation r
+                        JOIN m_reservation_stock rs ON r.m_reservation_id = rs.m_reservation_id
+                    WHERE r.res_status NOT IN ('CL', 'DR')
+                      AND r.m_product_id = :NEW.m_product_id
+                      AND r.c_uom_id = :NEW.c_uom_id
+                      AND COALESCE(rs.m_attributesetinstance_id, '0') = :NEW.m_attributesetinstance_id
+                      AND rs.m_locator_id = :NEW.m_locator_id);
+      IF (v_count > 0) THEN
+        SELECT COALESCE(sum(rs.quantity - COALESCE(rs.releasedqty,0)), 0), sd.qtyonhand
+          INTO v_reserved, v_onhand
         FROM m_reservation_stock rs
             JOIN m_reservation r ON rs.m_reservation_id = r.m_reservation_id
             JOIN m_storage_detail sd ON r.m_product_id = sd.m_product_id
                                         AND r.c_uom_id = sd.c_uom_id
-                                        AND  rs.m_attributesetinstance_id = COALESCE(sd.m_attributesetinstance_id, '0')
+                                        AND COALESCE(rs.m_attributesetinstance_id, '0') = COALESCE(sd.m_attributesetinstance_id, '0')
                                         AND rs.m_locator_id = sd.m_locator_id
                                         AND sd.m_product_uom_id IS NULL
         WHERE r.res_status NOT IN ('CL', 'DR')
           AND r.m_product_id = :NEW.m_product_id
           AND r.c_uom_id = :NEW.c_uom_id
-          AND rs.m_attributesetinstance_id = :NEW.m_attributesetinstance_id
+          AND COALESCE(rs.m_attributesetinstance_id, '0') = :NEW.m_attributesetinstance_id
           AND rs.m_locator_id = :NEW.m_locator_id
-        GROUP BY sd.qtyonhand, sd.m_storage_detail_id)
-      LOOP
-       	  v_reserved:=cur_reserve_stock.reservedQty;
-       	  v_onhand:=cur_reserve_stock.qtyonhand;
-      END LOOP;
-      IF (v_onhand - v_reserved < ABS(:NEW.movementqty) AND v_reserved > 0 AND :NEW.Checkreservedqty='Y') THEN
-        SELECT description
-          INTO v_attr_description
-        FROM M_AttributeSetInstance
-        WHERE M_AttributeSetInstance_ID = :NEW.m_attributesetinstance_id;
-        SELECT uomsymbol
-          INTO v_uom_value
-        FROM C_Uom
-        WHERE C_Uom_ID = :NEW.c_uom_id;
-        SELECT value
-          INTO v_locator_value
-        FROM M_Locator
-        WHERE M_Locator_ID = :NEW.m_locator_id;
-        RAISE_APPLICATION_ERROR(-20000, '@CannotTakeOutReservedStock@' || ' @of@' || ' @Product@: ' || v_product_value || ', @AttributeSetInstance@: ' || COALESCE(v_attr_description, '-') || ', @UOM@: ' || v_uom_value || ' @And@'||' @StorageBin@: ' || COALESCE(v_locator_value, '-'));
+        GROUP BY sd.qtyonhand, sd.m_storage_detail_id;
+        IF (v_onhand - v_reserved < ABS(:NEW.movementqty) AND v_reserved > 0) THEN
+	  SELECT value
+            INTO v_product_value
+          FROM M_Product
+          WHERE M_Product_ID = :NEW.m_product_id;
+
+          IF(:NEW.m_attributesetinstance_id IS NOT NULL) THEN
+            SELECT description
+              INTO v_attr_description
+            FROM M_AttributeSetInstance
+            WHERE M_AttributeSetInstance_ID = :NEW.m_attributesetinstance_id;
+          END IF;
+
+          SELECT uomsymbol
+            INTO v_uom_value
+          FROM C_Uom
+          WHERE C_Uom_ID = :NEW.c_uom_id;
+
+          IF (:NEW.m_locator_id IS NOT NULL) THEN
+            SELECT value
+              INTO v_locator_value
+            FROM M_Locator
+            WHERE M_Locator_ID = :NEW.m_locator_id;
+          END IF;
+          IF (:NEW.Checkreservedqty='Y') THEN
+          RAISE_APPLICATION_ERROR(-20000, '@CannotTakeOutReservedStock@' || ' @of@' || ' @Product@: ' || v_product_value || ', @AttributeSetInstance@: ' || COALESCE(v_attr_description, '-') || ', @UOM@: ' || COALESCE(v_uom_value, '-') || ' @And@'||' @StorageBin@: ' || COALESCE(v_locator_value, '-'));
+          END IF;
+        END IF;
       END IF;
+    END IF;
+    IF (:NEW.m_product_id IS NOT NULL) THEN
+      SELECT isgeneric, name INTO v_isgeneric, v_productname
+      FROM m_product
+      WHERE m_product_id = :NEW.m_product_id;
+      IF (v_isgeneric = 'Y') THEN
+        RAISE_APPLICATION_ERROR(-20000, '@CannotUseGenericProduct@');
+      END IF;
+    END IF;
   END IF;
 END M_TRANSACTION_TRG2
 ]]></body>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Tue Jun 02 13:25:52 2015 +0530
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Wed Jun 03 12:49:03 2015 +0200
@@ -19070,18 +19070,6 @@
 <!--4B01F0CD52ED45D78AD503199D5AB1C6-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--4B01F0CD52ED45D78AD503199D5AB1C6--></AD_MESSAGE>
 
-<!--4B824C2DFA5C467FBAEC01CD6873B578--><AD_MESSAGE>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <AD_MESSAGE_ID><![CDATA[4B824C2DFA5C467FBAEC01CD6873B578]]></AD_MESSAGE_ID>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <VALUE><![CDATA[OrderReactivateHasGoodsShipment]]></VALUE>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <MSGTEXT><![CDATA[The Order can not be reactivated because any of its lines is already linked to a Goods Shipment]]></MSGTEXT>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--4B824C2DFA5C467FBAEC01CD6873B578-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
-<!--4B824C2DFA5C467FBAEC01CD6873B578--></AD_MESSAGE>
-
 <!--4BAA0D78C8634088961947091B4D6633--><AD_MESSAGE>
 <!--4BAA0D78C8634088961947091B4D6633-->  <AD_MESSAGE_ID><![CDATA[4BAA0D78C8634088961947091B4D6633]]></AD_MESSAGE_ID>
 <!--4BAA0D78C8634088961947091B4D6633-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -20170,18 +20158,6 @@
 <!--65C05BD368ED471CB1E6AE97DD911EDF-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--65C05BD368ED471CB1E6AE97DD911EDF--></AD_MESSAGE>
 
-<!--65D856ED1A584F128F4C7AB8A2102DFA--><AD_MESSAGE>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <AD_MESSAGE_ID><![CDATA[65D856ED1A584F128F4C7AB8A2102DFA]]></AD_MESSAGE_ID>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <VALUE><![CDATA[OrderReactivateHasGoodsReceipt]]></VALUE>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <MSGTEXT><![CDATA[The Order can not be reactivated because any of its lines is already linked to a Goods Receipt]]></MSGTEXT>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--65D856ED1A584F128F4C7AB8A2102DFA-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
-<!--65D856ED1A584F128F4C7AB8A2102DFA--></AD_MESSAGE>
-
 <!--66BEE4A0FBD44C96B2967716918A1318--><AD_MESSAGE>
 <!--66BEE4A0FBD44C96B2967716918A1318-->  <AD_MESSAGE_ID><![CDATA[66BEE4A0FBD44C96B2967716918A1318]]></AD_MESSAGE_ID>
 <!--66BEE4A0FBD44C96B2967716918A1318-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-test/src/org/openbravo/test/accounting/PostDocumentTest.java	Tue Jun 02 13:25:52 2015 +0530
+++ b/src-test/src/org/openbravo/test/accounting/PostDocumentTest.java	Wed Jun 03 12:49:03 2015 +0200
@@ -201,16 +201,16 @@
       BigDecimal amtAcctDrObtained = fact.getDebit();
       BigDecimal amtSourceCrObtained = fact.getForeignCurrencyCredit();
       BigDecimal amtSourceDrObtained = fact.getForeignCurrencyDebit();
-      log.debug("****************  NEW ENTRY ***************");
-      log.debug("SeqNo: " + fact.getSequenceNumber());
-      log.debug("CurrencyId: " + fact.getCurrency().getId());
-      log.debug(OBDateUtils.formatDate(fact.getAccountingDate()));
-      log.debug(fact.getAccount().getIdentifier());
-      log.debug("AccountId: " + fact.getAccount().getId());
-      log.debug("Foreign Debit:" + fact.getForeignCurrencyDebit().toString());
-      log.debug("Foreign Credit:" + fact.getForeignCurrencyCredit().toString());
-      log.debug("Debit:" + fact.getDebit().toString());
-      log.debug("Credit:" + fact.getCredit().toString());
+      log.info("****************  NEW ENTRY ***************");
+      log.info("SeqNo: " + fact.getSequenceNumber());
+      log.info("CurrencyId: " + fact.getCurrency().getId());
+      log.info(OBDateUtils.formatDate(fact.getAccountingDate()));
+      log.info(fact.getAccount().getIdentifier());
+      log.info("AccountId: " + fact.getAccount().getId());
+      log.info("Foreign Debit:" + fact.getForeignCurrencyDebit().toString());
+      log.info("Foreign Credit:" + fact.getForeignCurrencyCredit().toString());
+      log.info("Debit:" + fact.getDebit().toString());
+      log.info("Credit:" + fact.getCredit().toString());
       assertThat("Wrong amtSourceDr", new BigDecimal(amtSourceDr),
           closeTo(amtSourceDrObtained, BigDecimal.ZERO));
       assertThat("Wrong amtSourceCr", new BigDecimal(amtSourceCr),
@@ -252,4 +252,4 @@
     }
     return;
   }
-}
+}
\ No newline at end of file
--- a/src/org/openbravo/costing/LandedCostProcess.java	Tue Jun 02 13:25:52 2015 +0530
+++ b/src/org/openbravo/costing/LandedCostProcess.java	Wed Jun 03 12:49:03 2015 +0200
@@ -284,7 +284,6 @@
     lcm.setOrganization(lcc.getOrganization());
     lcm.setLandedCostCost(lcc);
     lcm.setAmount(lcc.getAmount());
-    lcm.setAmountInInvoiceCurrency(lcc.getAmount());
     lcm.setInvoiceLine(lcc.getInvoiceLine());
     OBDal.getInstance().save(lcm);
 
--- a/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java	Tue Jun 02 13:25:52 2015 +0530
+++ b/src/org/openbravo/erpCommon/ad_forms/RequisitionToOrder.java	Wed Jun 03 12:49:03 2015 +0200
@@ -569,27 +569,38 @@
           line += 10;
           BigDecimal qtyAux = new BigDecimal(lines[i].lockqty);
           qtyOrder = qtyOrder.add(qtyAux);
-          if (lines[i].quantityorder != null && !"".equals(lines[i].quantityorder)) {
-            BigDecimal quantityAux = new BigDecimal(lines[i].quantityorder);
-            quantityOrder = quantityOrder.add(quantityAux);
-          } else {
-            quantityOrder = null;
-          }
+          BigDecimal quantityAux = new BigDecimal(lines[i].quantityorder);
+          quantityOrder = quantityOrder.add(quantityAux);
           if (log4j.isDebugEnabled())
             log4j.debug("Lockqty: " + lines[i].lockqty + " qtyorder: " + qtyOrder.toPlainString()
                 + " new BigDecimal: " + (new BigDecimal(lines[i].lockqty)).toString() + " qtyAux: "
                 + qtyAux.toString());
 
           try {
-            RequisitionToOrderData.insertCOrderline(conn, this, strCOrderlineID, vars.getClient(),
-                strOrg, vars.getUser(), strCOrderId, Integer.toString(line), strVendor,
-                RequisitionToOrderData.cBPartnerLocationId(this, strVendor), strOrderDate,
-                lines[i].needbydate, lines[i].description, lines[i].mProductId,
-                lines[i].mAttributesetinstanceId, strWarehouse, lines[i].mProductUomId,
-                lines[i].cUomId, quantityOrder != null ? quantityOrder.toPlainString() : null,
-                qtyOrder.toPlainString(), cCurrencyId, lines[i].pricelist, lines[i].priceactual,
-                strPriceListId, lines[i].pricelimit, lines[i].tax, "", lines[i].discount,
-                lines[i].grossUnit, lines[i].grossAmt);
+            RequisitionToOrderData
+                .insertCOrderline(
+                    conn,
+                    this,
+                    strCOrderlineID,
+                    vars.getClient(),
+                    strOrg,
+                    vars.getUser(),
+                    strCOrderId,
+                    Integer.toString(line),
+                    strVendor,
+                    RequisitionToOrderData.cBPartnerLocationId(this, strVendor),
+                    strOrderDate,
+                    lines[i].needbydate,
+                    lines[i].description,
+                    lines[i].mProductId,
+                    lines[i].mAttributesetinstanceId,
+                    strWarehouse,
+                    lines[i].mProductUomId,
+                    lines[i].cUomId,
+                    quantityOrder != null && BigDecimal.ZERO.compareTo(quantityOrder) != 0 ? quantityOrder
+                        .toPlainString() : "", qtyOrder.toPlainString(), cCurrencyId,
+                    lines[i].pricelist, lines[i].priceactual, strPriceListId, lines[i].pricelimit,
+                    lines[i].tax, "", lines[i].discount, lines[i].grossUnit, lines[i].grossAmt);
           } catch (ServletException ex) {
             myMessage = Utility.translateError(this, vars, vars.getLanguage(), ex.getMessage());
             releaseRollbackConnection(conn);
--- a/src/org/openbravo/event/CharacteristicValueEventHandler.java	Tue Jun 02 13:25:52 2015 +0530
+++ b/src/org/openbravo/event/CharacteristicValueEventHandler.java	Wed Jun 03 12:49:03 2015 +0200
@@ -129,4 +129,4 @@
       logger.error("Error executing process", e);
     }
   }
-}
+}
\ No newline at end of file
--- a/src/org/openbravo/financial/ResetAccounting.java	Tue Jun 02 13:25:52 2015 +0530
+++ b/src/org/openbravo/financial/ResetAccounting.java	Wed Jun 03 12:49:03 2015 +0200
@@ -289,7 +289,7 @@
 
       String strUpdate = "update "
           + tableName
-          + " set posted='N', processNow=false where posted not in ('Y') and processed = 'Y' and organization.id in (:orgIds)  ";
+          + " set posted='N', processing='N' where posted not in ('Y') and processed = 'Y' and AD_Org_ID in (:orgIds)  ";
       if (!("".equals(datefrom))) {
         strUpdate = strUpdate + " and " + tableDate + " >= :dateFrom ";
       }