Merged from PI
authorUnai Martirena <unai.martirena@openbravo.com>
Fri, 15 Apr 2016 13:24:44 +0200
changeset 29182 7247e4ab5c09
parent 29181 51adf3f34dbe (current diff)
parent 29015 3b8d384cb998 (diff)
child 29183 f399c5c5daa3
Merged from PI
modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java
src-db/database/model/tables/AD_COLUMN.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_ELEMENT.xml
src-db/database/sourcedata/AD_FIELD.xml
src-db/database/sourcedata/AD_MESSAGE.xml
src-db/database/sourcedata/AD_REF_LIST.xml
src-test/src/org/openbravo/test/AllAntTaskTests.java
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Thu Apr 14 18:51:24 2016 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/dao/AdvPaymentMngtDao.java	Fri Apr 15 13:24:44 2016 +0200
@@ -579,8 +579,9 @@
       newPaymentDetail.setFINPaymentScheduleDetailList(paymentScheduleDetails);
 
       if (payment.getDocumentType().getDocumentSequence() != null) {
+        FIN_Payment reloadedPayment = OBDal.getInstance().get(FIN_Payment.class, payment.getId());
         OBContext.getOBContext().addWritableOrganization(
-            payment.getDocumentType().getDocumentSequence().getOrganization().getId());
+            reloadedPayment.getDocumentType().getDocumentSequence().getOrganization().getId());
       }
 
       OBDal.getInstance().save(payment);
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Thu Apr 14 18:51:24 2016 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/process/FIN_PaymentProcess.java	Fri Apr 15 13:24:44 2016 +0200
@@ -87,16 +87,10 @@
       // retrieve standard params
       final String recordID = (String) bundle.getParams().get("Fin_Payment_ID");
       final FIN_Payment payment = OBDal.getInstance().get(FIN_Payment.class, recordID);
-      final Boolean isPosOrder;
-      if (bundle.getParams().get("isPOSOrder") == null) {
-        isPosOrder = false;
-      } else {
-        isPosOrder = bundle.getParams().get("isPOSOrder").equals("Y");
-      }
       final String paymentDate = (String) bundle.getParams().get("paymentdate");
       final boolean doFlush = bundle.getParams().get("doFlush") != null ? (Boolean) bundle
           .getParams().get("doFlush") : true;
-      processPayment(payment, strAction, isPosOrder, paymentDate, comingFrom,
+      processPayment(payment, strAction, paymentDate, comingFrom,
           selectedCreditLineIds, doFlush);
       bundle.setResult(msg);
     } catch (Exception e) {
@@ -110,15 +104,20 @@
   }
 
   // ProcessPayment without a return type
+  public static void doProcessPayment(FIN_Payment payment, String strAction, String paymentDate,
+      String comingFrom) throws OBException {
+    FIN_PaymentProcess fpp = WeldUtils.getInstanceFromStaticBeanManager(FIN_PaymentProcess.class);
+    fpp.processPayment(payment, strAction, paymentDate, comingFrom, null, true);
+  }
+
+  @Deprecated
   public static void doProcessPayment(FIN_Payment payment, String strAction, Boolean isPosOrder,
       String paymentDate, String comingFrom) throws OBException {
-    FIN_PaymentProcess fpp = WeldUtils.getInstanceFromStaticBeanManager(FIN_PaymentProcess.class);
-    fpp.processPayment(payment, strAction, isPosOrder, paymentDate, comingFrom, null, true);
+    doProcessPayment(payment, strAction, paymentDate, comingFrom);
   }
 
-  private void processPayment(FIN_Payment payment, String strAction, Boolean isPosOrder,
-      String paymentDate, String comingFrom, String selectedCreditLineIds, boolean doFlush)
-      throws OBException {
+  private void processPayment(FIN_Payment payment, String strAction, String paymentDate,
+      String comingFrom, String selectedCreditLineIds, boolean doFlush) throws OBException {
     dao = new AdvPaymentMngtDao();
     String msg = "";
     try {
@@ -258,36 +257,34 @@
               glitems.add(paymentDetail.getGLItem().getName());
           }
           // Set description
-          if (!isPosOrder) {
-            StringBuffer description = new StringBuffer();
+          StringBuffer description = new StringBuffer();
 
-            if (payment.getDescription() != null && !payment.getDescription().equals(""))
-              description.append(payment.getDescription()).append("\n");
-            if (!invoiceDocNos.isEmpty()) {
-              description.append(OBMessageUtils.messageBD("InvoiceDocumentno"));
-              description.append(": ").append(
-                  invoiceDocNos.toString().substring(1, invoiceDocNos.toString().length() - 1));
-              description.append("\n");
-            }
-            if (!orderDocNos.isEmpty()) {
-              description.append(OBMessageUtils.messageBD("OrderDocumentno"));
-              description.append(": ").append(
-                  orderDocNos.toString().substring(1, orderDocNos.toString().length() - 1));
-              description.append("\n");
-            }
-            if (!glitems.isEmpty()) {
-              description.append(OBMessageUtils.messageBD("APRM_GLItem"));
-              description.append(": ").append(
-                  glitems.toString().substring(1, glitems.toString().length() - 1));
-              description.append("\n");
-            }
-            if (!"".equals(strRefundCredit))
-              description.append(strRefundCredit).append("\n");
+          if (payment.getDescription() != null && !payment.getDescription().equals(""))
+            description.append(payment.getDescription()).append("\n");
+          if (!invoiceDocNos.isEmpty()) {
+            description.append(OBMessageUtils.messageBD("InvoiceDocumentno"));
+            description.append(": ").append(
+                invoiceDocNos.toString().substring(1, invoiceDocNos.toString().length() - 1));
+            description.append("\n");
+          }
+          if (!orderDocNos.isEmpty()) {
+            description.append(OBMessageUtils.messageBD("OrderDocumentno"));
+            description.append(": ").append(
+                orderDocNos.toString().substring(1, orderDocNos.toString().length() - 1));
+            description.append("\n");
+          }
+          if (!glitems.isEmpty()) {
+            description.append(OBMessageUtils.messageBD("APRM_GLItem"));
+            description.append(": ").append(
+                glitems.toString().substring(1, glitems.toString().length() - 1));
+            description.append("\n");
+          }
+          if (!"".equals(strRefundCredit))
+            description.append(strRefundCredit).append("\n");
 
-            String truncateDescription = (description.length() > 255) ? description
-                .substring(0, 251).concat("...").toString() : description.toString();
-            payment.setDescription(truncateDescription);
-          }
+          String truncateDescription = (description.length() > 255) ? description.substring(0, 251)
+              .concat("...").toString() : description.toString();
+          payment.setDescription(truncateDescription);
 
           if (paymentAmount.compareTo(payment.getAmount()) != 0) {
             payment.setUsedCredit(paymentAmount.subtract(payment.getAmount()));
@@ -323,9 +320,8 @@
             }
           }
           // Execution Process
-          if (!isPosOrder
-              && dao.isAutomatedExecutionPayment(payment.getAccount(), payment.getPaymentMethod(),
-                  payment.isReceipt())) {
+          if (dao.isAutomatedExecutionPayment(payment.getAccount(), payment.getPaymentMethod(),
+              payment.isReceipt())) {
             try {
               payment.setStatus("RPAE");
 
@@ -659,7 +655,7 @@
         String newStrAction = "P";
         FIN_PaymentProcess fpp = WeldUtils
             .getInstanceFromStaticBeanManager(FIN_PaymentProcess.class);
-        fpp.processPayment(reversedPayment, newStrAction, isPosOrder, paymentDate, comingFrom,
+        fpp.processPayment(reversedPayment, newStrAction, paymentDate, comingFrom,
             selectedCreditLineIds, true);
 
         return;
--- a/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Thu Apr 14 18:51:24 2016 +0200
+++ b/modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java	Fri Apr 15 13:24:44 2016 +0200
@@ -356,17 +356,31 @@
           seq = obcSeq.list().get(0);
         }
       }
-      if (seq != null) {
-        if (seq.getPrefix() != null)
-          nextDocNumber = seq.getPrefix();
-        nextDocNumber += seq.getNextAssignedNumber().toString();
-        if (seq.getSuffix() != null)
-          nextDocNumber += seq.getSuffix();
-        if (updateNext) {
-          seq.setNextAssignedNumber(seq.getNextAssignedNumber() + seq.getIncrementBy());
-          OBDal.getInstance().save(seq);
-          // OBDal.getInstance().flush();
-        }
+      nextDocNumber = getDocumentNo(seq, updateNext);
+    }
+    return nextDocNumber;
+  }
+
+  /**
+   * Returns the next sequence number for the given sequence.
+   * 
+   * @param Entity
+   *          which holds the sequence number
+   * @return the next sequence number of the Document Type defined for the Organization and document
+   *         category. Null if no sequence is found.
+   */
+  public static String getDocumentNo(Sequence seq, boolean updateNext) {
+    String nextDocNumber = "";
+    if (seq != null) {
+      if (seq.getPrefix() != null)
+        nextDocNumber = seq.getPrefix();
+      nextDocNumber += seq.getNextAssignedNumber().toString();
+      if (seq.getSuffix() != null)
+        nextDocNumber += seq.getSuffix();
+      if (updateNext) {
+        seq.setNextAssignedNumber(seq.getNextAssignedNumber() + seq.getIncrementBy());
+        OBDal.getInstance().save(seq);
+        // OBDal.getInstance().flush();
       }
     }
 
--- a/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java	Thu Apr 14 18:51:24 2016 +0200
+++ b/modules/org.openbravo.client.application/src/org/openbravo/client/application/ApplicationComponentProvider.java	Fri Apr 15 13:24:44 2016 +0200
@@ -469,6 +469,9 @@
     globalResources.add(createStaticResource("web/js/productCharacteristicsProcess.js", true));
     globalResources.add(createStaticResource("web/js/recalculatePermissionsProcess.js", true));
     globalResources.add(createStaticResource("web/js/validateCostingRuleProcess.js", true));
+    globalResources.add(createStaticResource("web/js/cancelAndReplaceSalesOrderProcess.js", false));
+    globalResources.add(createStaticResource("web/js/confirmCancelAndReplaceSalesOrderProcess.js",
+        false));
     globalResources.add(createStaticResource("web/js/checkAvailableCredit.js", true));
 
     // Product Services
--- a/src-db/database/model/functions/C_ORDER_POST1.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/functions/C_ORDER_POST1.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -103,6 +103,7 @@
   END_PROCESSING BOOLEAN:=FALSE;
   v_CBPartner_ID VARCHAR2(32);
   rowcount NUMBER;
+  v_stockqty NUMBER;
 
   v_CumDiscount NUMBER;
   v_OldCumDiscount NUMBER;
@@ -323,6 +324,36 @@
       RAISE_APPLICATION_ERROR(-20000, '@CannotUseGenericProduct@ ' || v_productName);
     END IF;
 
+    /*Locked and Discontinued Products*/
+    IF (v_IsSOTrx = 'Y' AND v_DocAction='CO') THEN
+	    FOR Cur_line IN
+	      (SELECT SUM(ol.qtyordered) AS qtyordered, ol.ad_org_id, ol.m_product_id, ol.c_uom_id, COALESCE(ol.m_attributesetinstance_id, '0') AS m_attributesetinstance_id, COALESCE(ol.m_product_uom_id, '0') AS m_product_uom_id, p.islocked, p.issalediscontinued, p.name, p.isstocked, p.producttype
+	       FROM c_orderline ol JOIN m_product p ON ol.m_product_id = p.m_product_id
+	       WHERE ol.c_order_id = v_Record_ID 
+	       GROUP BY ol.ad_org_id, ol.m_product_id, ol.c_uom_id, COALESCE(ol.m_attributesetinstance_id, '0'), COALESCE(ol.m_product_uom_id, '0'), p.islocked, p.issalediscontinued, p.name, p.isstocked, p.producttype
+	      )
+	    LOOP
+          IF (Cur_line.isstocked = 'Y' AND Cur_line.producttype = 'I') THEN
+		    IF (Cur_line.islocked='Y') THEN
+			  RAISE_APPLICATION_ERROR(-20000, '@CannotUseLockedProduct@ ' || Cur_line.name);
+		    ELSIF (Cur_line.issalediscontinued='Y') THEN
+			  SELECT COALESCE(SUM(sd.qtyonhand-sd.reservedqty), 0) INTO v_stockqty
+			  FROM m_storage_detail sd
+			  JOIN m_locator loc on loc.m_locator_id = sd.m_locator_id
+			  WHERE sd.m_product_id = Cur_line.m_product_id
+              AND sd.c_uom_id = Cur_line.c_uom_id
+              AND COALESCE(sd.m_attributesetinstance_id, '0') = Cur_line.m_attributesetinstance_id
+              AND COALESCE(sd.m_product_uom_id, '0') = Cur_line.m_product_uom_id
+			  AND loc.m_warehouse_id IN (SELECT m_warehouse_id FROM AD_Org_Warehouse WHERE ad_org_id = v_Org_ID);
+
+			  IF (Cur_line.qtyordered > v_stockqty) THEN
+                RAISE_APPLICATION_ERROR(-20000, '@CannotUseDiscontinuedProduct@ ' || Cur_line.name || '. @ProductDiscontinuedNoStock@' || '(' || v_stockqty || ').');
+			  END IF;
+		    END IF;
+          END IF;
+	    END LOOP;
+    END IF;
+
     /** 
     * Quotations
     */
--- a/src-db/database/model/functions/M_INOUT_POST.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/functions/M_INOUT_POST.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -517,7 +517,7 @@
             (SELECT *
             FROM M_INOUTLINE
             WHERE M_InOut_ID=Cur_InOut.M_InOut_ID
-              AND IsActive='Y'  FOR UPDATE
+              AND IsActive='Y' ORDER BY line FOR UPDATE
             )
           LOOP
             -- Incomming or Outgoing :1:2
--- a/src-db/database/model/functions/M_MOVEMENT_POST.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/functions/M_MOVEMENT_POST.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -4,6 +4,9 @@
       <parameter name="pinstance_id" type="VARCHAR" mode="in">
         <default/>
       </parameter>
+      <parameter name="p_movement_id" type="VARCHAR" mode="in">
+        <default><![CDATA[NULL]]></default>
+      </parameter>
       <body><![CDATA[/*************************************************************************
   * The contents of this file are subject to the Compiere Public
   * License 1.1 ("License"); You may not use this file except in
@@ -57,30 +60,37 @@
     END_PROCESS BOOLEAN:=false;
     v_productname m_product.name%TYPE;
   BEGIN
+  IF (pinstance_id IS NOT NULL) THEN
     --  Update AD_PInstance
     DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || PInstance_ID) ;
     v_ResultStr:='PInstanceNotFound';
     AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'Y', NULL, NULL) ;
+  END IF;
   BEGIN --BODY
-    -- Get Parameters
-    v_ResultStr:='ReadingParameters';
-    FOR Cur_Parameter IN
-      (SELECT i.Record_ID,
-        i.AD_User_ID,
-        p.ParameterName,
-        p.P_String,
-        p.P_Number,
-        p.P_Date
-      FROM AD_PInstance i
-      LEFT JOIN AD_PInstance_Para p
-        ON i.AD_PInstance_ID=p.AD_PInstance_ID
-      WHERE i.AD_PInstance_ID=PInstance_ID
-      ORDER BY p.SeqNo
-      )
-    LOOP
-      v_Record_ID:=Cur_Parameter.Record_ID;
-      v_p_User:=Cur_Parameter.AD_User_ID;
-    END LOOP; -- Get Parameter
+	  IF (pinstance_id IS NOT NULL) THEN
+	    -- Get Parameters
+	    v_ResultStr:='ReadingParameters';
+	    FOR Cur_Parameter IN
+	      (SELECT i.Record_ID,
+	        i.AD_User_ID,
+	        p.ParameterName,
+	        p.P_String,
+	        p.P_Number,
+	        p.P_Date
+	      FROM AD_PInstance i
+	      LEFT JOIN AD_PInstance_Para p
+	        ON i.AD_PInstance_ID=p.AD_PInstance_ID
+	      WHERE i.AD_PInstance_ID=PInstance_ID
+	      ORDER BY p.SeqNo
+	      )
+	    LOOP
+	      v_Record_ID:=Cur_Parameter.Record_ID;
+	      v_p_User:=Cur_Parameter.AD_User_ID;
+	    END LOOP; -- Get Parameter
+    ELSE
+	    v_Record_ID:=p_movement_id;
+      SELECT createdby INTO v_p_User FROM m_movement WHERE m_movement_id = v_Record_ID ;
+	  END IF;
     DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
     -- Reading Movement
     SELECT MovementDate,
@@ -338,9 +348,13 @@
     v_ResultStr:='UnLockingMovement';
     UPDATE M_Movement  SET Processing='N'  WHERE M_Movement_ID=v_Record_ID;
 
+    IF(pinstance_id IS NOT NULL) THEN
     --  Update AD_PInstance
-    DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
-    AD_UPDATE_PINSTANCE(PInstance_ID, v_p_User, 'N', v_Result, v_Message) ;
+      DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
+      AD_UPDATE_PINSTANCE(PInstance_ID, v_p_User, 'N', v_Result, v_Message) ;
+    ELSE
+      DBMS_OUTPUT.PUT_LINE('--<<M_MovementPost finished>>') ;
+    END IF ;
     RETURN;
   END; --BODY
 EXCEPTION
@@ -350,7 +364,9 @@
   ROLLBACK;
   UPDATE M_Movement  SET Processing='N',Updated=now(),UpdatedBy=v_p_User  WHERE M_Movement_ID=v_Record_ID;
   -- Commented by cromero 19102006 COMMIT;
-  AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 0, v_ResultStr) ;
+  IF(pinstance_id IS NOT NULL) THEN
+    AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 0, v_ResultStr) ;
+  END IF ;
   RETURN;
 END M_MOVEMENT_POST
 ]]></body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_MOVEMENT_POST0.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_MOVEMENT_POST0">
+    <function name="M_MOVEMENT_POST0" type="NULL">
+      <parameter name="pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <body><![CDATA[/*************************************************************************
+  * The contents of this file are subject to the Compiere Public
+  * License 1.1 ("License"); You may not use this file except in
+  * compliance with the License. You may obtain a copy of the License in
+  * the legal folder of your Openbravo installation.
+  * Software distributed under the License is distributed on an
+  * "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+  * implied. See the License for the specific language governing rights
+  * and limitations under the License.
+  * The Original Code is  Compiere  ERP &  Business Solution
+  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
+  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke,
+  * 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.
+  *
+  * Specifically, this derivative work is based upon the following Compiere
+  * file and version.
+  *************************************************************************
+  * $Id: C_Invoice_Post0.sql,v 1.2 2002/10/21 04:49:46 jjanke Exp $
+  ***
+  * Title:  Post single Invoice
+  *************************************************************************/
+BEGIN
+  M_MOVEMENT_POST(pinstance_id, NULL);
+END M_MOVEMENT_POST0
+]]></body>
+    </function>
+  </database>
--- a/src-db/database/model/functions/M_RESERVATION_POST.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/functions/M_RESERVATION_POST.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -13,6 +13,9 @@
       <parameter name="p_user_id" type="VARCHAR" mode="in">
         <default/>
       </parameter>
+      <parameter name="p_qty" type="NUMERIC" mode="in">
+        <default><![CDATA[NULL]]></default>
+      </parameter>
       <body><![CDATA[/*************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
@@ -417,7 +420,7 @@
 
   IF (v_resaction = 'PR') THEN
     -- ADD RESERVED STOCK
-    M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message);
+    M_RESERVE_STOCK_AUTO(v_reservation_id, v_user_id, v_message, p_qty);
   END IF;
 
   /* Do not process reservation's with no lines
--- a/src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -10,6 +10,9 @@
       <parameter name="p_reservedqty" type="NUMERIC" mode="out">
         <default/>
       </parameter>
+      <parameter name="p_qty" type="NUMERIC" mode="in">
+        <default><![CDATA[NULL]]></default>
+      </parameter>
       <body><![CDATA[/*************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
@@ -87,6 +90,11 @@
   END; -- End Call M_GET_STOCK
   
   v_pendingqty := v_pendingtoreserveqty;
+  
+  IF (p_qty IS NOT NULL) THEN
+    v_pendingqty := p_qty;
+  END IF;
+  
   FOR cur_stock IN (
     SELECT sp.quantity, sp.m_storage_detail_id, w.isallocated
     FROM m_stock_proposed sp
--- a/src-db/database/model/tables/C_BPARTNER.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/tables/C_BPARTNER.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -377,6 +377,14 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="BIRTHPLACE" primaryKey="false" required="false" type="VARCHAR" size="60" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="BIRTHDAY" primaryKey="false" required="false" type="TIMESTAMP" size="7" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_LANGUAGE" name="AD_LANGUAGE_C_BUSPARTNER">
         <reference local="AD_LANGUAGE" foreign="AD_LANGUAGE"/>
       </foreign-key>
--- a/src-db/database/model/tables/C_ORDER.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/tables/C_ORDER.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -341,6 +341,26 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="CANCELANDREPLACE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="CONFIRMCANCELANDREPLACE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="CANCELLEDORDER_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="REPLACEDORDER_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="ISCANCELLED" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault><![CDATA['N']]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="C_DOCTYPE" name="C_DOCTYPE_CORDER">
         <reference local="C_DOCTYPE_ID" foreign="C_DOCTYPE_ID"/>
       </foreign-key>
@@ -401,6 +421,9 @@
       <foreign-key foreignTable="C_RETURN_REASON" name="C_ORDER_C_RETURN_REASON">
         <reference local="C_RETURN_REASON_ID" foreign="C_RETURN_REASON_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ORDER" name="C_ORDER_CANCELLEDORDER">
+        <reference local="CANCELLEDORDER_ID" foreign="C_ORDER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="C_BPARTNER" name="C_ORDER_DROPSHIP_BPARTNER">
         <reference local="DROPSHIP_BPARTNER_ID" foreign="C_BPARTNER_ID"/>
       </foreign-key>
@@ -428,6 +451,9 @@
       <foreign-key foreignTable="C_REJECT_REASON" name="C_ORDER_REJECT_REASON">
         <reference local="C_REJECT_REASON_ID" foreign="C_REJECT_REASON_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ORDER" name="C_ORDER_REPLACEDORDER">
+        <reference local="REPLACEDORDER_ID" foreign="C_ORDER_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="AD_USER" name="C_ORDER_SALESREP">
         <reference local="SALESREP_ID" foreign="AD_USER_ID"/>
       </foreign-key>
@@ -446,6 +472,9 @@
       <index name="C_ORDER_C_RETURN_REASON" unique="false">
         <index-column name="C_RETURN_REASON_ID"/>
       </index>
+      <index name="C_ORDER_CANCELLEDORDER_ID" unique="false">
+        <index-column name="CANCELLEDORDER_ID"/>
+      </index>
       <index name="C_ORDER_CLIENT_ORG_DATE_DOCNO" unique="false">
         <index-column name="AD_CLIENT_ID"/>
         <index-column name="AD_ORG_ID"/>
@@ -466,10 +495,14 @@
       <index name="C_ORDER_POSTED" unique="false">
         <index-column name="POSTED"/>
       </index>
+      <index name="C_ORDER_REPLACEDORDER_ID" unique="false">
+        <index-column name="REPLACEDORDER_ID"/>
+      </index>
       <index name="C_ORDER_UPDATED" unique="false">
         <index-column name="UPDATED"/>
       </index>
       <check name="C_ORDER_ISACTIVE_CHECK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+      <check name="C_ORDER_ISCANCELANDREPLA_CHECK"><![CDATA[ISCANCELLED IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISCASHVAT_CH"><![CDATA[ISCASHVAT IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISDELIVERED_CHECK"><![CDATA[ISDELIVERED IN ('Y', 'N')]]></check>
       <check name="C_ORDER_ISDISCOUNTPRINTED_CHK"><![CDATA[ISDISCOUNTPRINTED IN ('Y', 'N')]]></check>
--- a/src-db/database/model/tables/C_ORDERLINE.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/tables/C_ORDERLINE.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -269,6 +269,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="REPLACEDORDERLINE_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <column name="PRINT_DESCRIPTION" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
         <default><![CDATA[N]]></default>
         <onCreateDefault><![CDATA['N']]></onCreateDefault>
@@ -350,6 +354,9 @@
       <foreign-key foreignTable="C_ORDERLINE" name="C_ORDERLINE_QUOTATION">
         <reference local="QUOTATIONLINE_ID" foreign="C_ORDERLINE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="C_ORDERLINE" name="C_ORDERLINE_REPLACEDORDERLINE">
+        <reference local="REPLACEDORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
+      </foreign-key>
       <foreign-key foreignTable="S_RESOURCEASSIGNMENT" name="C_ORDERLINE_S_RESOURCEASSIGNME">
         <reference local="S_RESOURCEASSIGNMENT_ID" foreign="S_RESOURCEASSIGNMENT_ID"/>
       </foreign-key>
--- a/src-db/database/model/tables/M_PRODUCT.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/tables/M_PRODUCT.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -377,10 +377,6 @@
         <default><![CDATA[N]]></default>
         <onCreateDefault><![CDATA['N']]></onCreateDefault>
       </column>
-      <column name="UNIQUE_PER_DOCUMENT" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
-        <default><![CDATA[N]]></default>
-        <onCreateDefault><![CDATA['N']]></onCreateDefault>
-      </column>
       <column name="RELATEPRODCATTOSERVICE" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
         <default/>
         <onCreateDefault/>
@@ -405,6 +401,18 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="UNIQUE_PER_DOCUMENT" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault><![CDATA['N']]></onCreateDefault>
+      </column>
+      <column name="ISLOCKED" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="ISSALEDISCONTINUED" primaryKey="false" required="false" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MPRODUCT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
--- a/src-db/database/model/views/C_INVOICE_CANDIDATE_V.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/model/views/C_INVOICE_CANDIDATE_V.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW C_INVOICE_CANDIDATE_V">
-    <view name="C_INVOICE_CANDIDATE_V"><![CDATA[SELECT sq.ad_client_id, sq.ad_org_id, sq.c_bpartner_id, sq.c_order_id, sq.documentno, sq.dateordered, sq.c_doctype_id, sq.amountlines, sq.amountlinesgross, sq.notinvoicedlines, round(sq.notinvoicedlinesgross, c.stdprecision) AS notinvoicedlinesgross, sq.term, sq.pendinglines, round(sq.pendinglinesgross, c.stdprecision) AS pendinglinesgross, sq.qtyordered, sq.qtydelivered FROM (SELECT o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.c_doctype_id, o.totallines AS amountlines, o.grandtotal AS amountlinesgross, sum(round((l.qtyordered - l.qtyinvoiced) * l.priceactual, c_1.stdprecision)) AS notinvoicedlines, sum(round((l.qtyordered - l.qtyinvoiced) * l.priceactual, c_1.stdprecision) * (1 + t.rate / 100)) AS notinvoicedlinesgross, o.invoicerule AS term, sum(round((l.qtydelivered - l.qtyinvoiced) * l.priceactual, c_1.stdprecision)) AS pendinglines, sum(round((l.qtydelivered - l.qtyinvoiced) * l.priceactual, c_1.stdprecision) * (1 + t.rate / 100)) AS pendinglinesgross, sum(abs(l.qtyordered)) AS qtyordered, sum(abs(l.qtydelivered)) AS qtydelivered, o.m_pricelist_id, c_1.c_currency_id FROM c_order o JOIN m_pricelist p_1 ON o.m_pricelist_id = p_1.m_pricelist_id JOIN c_currency c_1 ON p_1.c_currency_id = c_1.c_currency_id JOIN c_orderline l ON o.c_order_id = l.c_order_id JOIN c_bpartner bp ON o.c_bpartner_id = bp.c_bpartner_id JOIN c_tax t ON t.c_tax_id = l.c_tax_id LEFT JOIN c_invoiceschedule si ON bp.c_invoiceschedule_id = si.c_invoiceschedule_id WHERE (o.docstatus IN ('CO', 'CL', 'IP')) AND (o.c_doctype_id IN (SELECT c_doctype.c_doctype_id FROM c_doctype WHERE c_doctype.docbasetype = 'SOO' AND (c_doctype.docsubtypeso NOT IN ('ON', 'OB', 'WR')))) AND (o.invoicerule = 'I' OR o.invoicerule = 'O' OR o.invoicerule = 'N' OR o.invoicerule = 'D' OR o.invoicerule = 'S' AND (si.invoicefrequency IS NULL OR si.invoicefrequency = 'D' OR si.invoicefrequency = 'W' OR si.invoicefrequency = 'T' AND trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff - 1) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday - 1) OR trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff + 14) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday + 14) OR si.invoicefrequency = 'M' AND trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff - 1) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday - 1))) AND (abs(l.qtyordered - l.qtyinvoiced) <> 0 OR abs(l.qtydelivered - l.qtyinvoiced) <> 0) GROUP BY o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.c_doctype_id, o.totallines, o.grandtotal, o.invoicerule, o.m_pricelist_id, c_1.c_currency_id) sq JOIN m_pricelist p ON sq.m_pricelist_id = p.m_pricelist_id JOIN c_currency c ON sq.c_currency_id = c.c_currency_id]]></view>
+    <view name="C_INVOICE_CANDIDATE_V"><![CDATA[SELECT sq.ad_client_id, sq.ad_org_id, sq.c_bpartner_id, sq.c_order_id, sq.documentno, sq.dateordered, sq.c_doctype_id, sq.amountlines, sq.amountlinesgross, sq.notinvoicedlines, round(sq.notinvoicedlinesgross, c.stdprecision) AS notinvoicedlinesgross, sq.term, sq.pendinglines, round(sq.pendinglinesgross, c.stdprecision) AS pendinglinesgross, sq.qtyordered, sq.qtydelivered FROM (SELECT o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.c_doctype_id, o.totallines AS amountlines, o.grandtotal AS amountlinesgross, sum(round((l.qtyordered - l.qtyinvoiced) * l.priceactual, c_1.stdprecision)) AS notinvoicedlines, sum(round((l.qtyordered - l.qtyinvoiced) * l.priceactual, c_1.stdprecision) * (1 + t.rate / 100)) AS notinvoicedlinesgross, o.invoicerule AS term, sum(round((l.qtydelivered - l.qtyinvoiced) * l.priceactual, c_1.stdprecision)) AS pendinglines, sum(round((l.qtydelivered - l.qtyinvoiced) * l.priceactual, c_1.stdprecision) * (1 + t.rate / 100)) AS pendinglinesgross, sum(abs(l.qtyordered)) AS qtyordered, sum(abs(l.qtydelivered)) AS qtydelivered, o.m_pricelist_id, c_1.c_currency_id FROM c_order o JOIN m_pricelist p_1 ON o.m_pricelist_id = p_1.m_pricelist_id JOIN c_currency c_1 ON p_1.c_currency_id = c_1.c_currency_id JOIN c_orderline l ON o.c_order_id = l.c_order_id JOIN c_bpartner bp ON o.c_bpartner_id = bp.c_bpartner_id JOIN c_tax t ON t.c_tax_id = l.c_tax_id LEFT JOIN c_invoiceschedule si ON bp.c_invoiceschedule_id = si.c_invoiceschedule_id WHERE (o.docstatus IN ('CO', 'CL', 'IP')) AND (o.c_doctype_id IN (SELECT c_doctype.c_doctype_id FROM c_doctype WHERE c_doctype.docbasetype = 'SOO' AND (c_doctype.docsubtypeso NOT IN ('ON', 'OB')))) AND (o.invoicerule = 'I' OR o.invoicerule = 'O' OR o.invoicerule = 'N' OR o.invoicerule = 'D' OR o.invoicerule = 'S' AND (si.invoicefrequency IS NULL OR si.invoicefrequency = 'D' OR si.invoicefrequency = 'W' OR si.invoicefrequency = 'T' AND trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff - 1) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday - 1) OR trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff + 14) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday + 14) OR si.invoicefrequency = 'M' AND trunc(o.dateordered) <= (TRUNC(now(), 'MM') + si.invoicedaycutoff - 1) AND trunc(now()) >= (TRUNC(o.dateordered, 'MM') + si.invoiceday - 1))) AND (abs(l.qtyordered - l.qtyinvoiced) <> 0 OR abs(l.qtydelivered - l.qtyinvoiced) <> 0) GROUP BY o.ad_client_id, o.ad_org_id, o.c_bpartner_id, o.c_order_id, o.documentno, o.dateordered, o.c_doctype_id, o.totallines, o.grandtotal, o.invoicerule, o.m_pricelist_id, c_1.c_currency_id) sq JOIN m_pricelist p ON sq.m_pricelist_id = p.m_pricelist_id JOIN c_currency c ON sq.c_currency_id = c.c_currency_id]]></view>
   </database>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -246925,6 +246925,43 @@
 <!--0FA23D0D90E34E8790627C9928566EE3-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--0FA23D0D90E34E8790627C9928566EE3--></AD_COLUMN>
 
+<!--1040A945DD4048AD8D43449847A6EB11--><AD_COLUMN>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <AD_COLUMN_ID><![CDATA[1040A945DD4048AD8D43449847A6EB11]]></AD_COLUMN_ID>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <NAME><![CDATA[Birth Day]]></NAME>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <DESCRIPTION><![CDATA[An anniversary of birth for a business partner.]]></DESCRIPTION>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <HELP><![CDATA[Birthday or Anniversary day]]></HELP>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <COLUMNNAME><![CDATA[Birthday]]></COLUMNNAME>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <AD_TABLE_ID><![CDATA[291]]></AD_TABLE_ID>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <AD_REFERENCE_ID><![CDATA[15]]></AD_REFERENCE_ID>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <SEQNO><![CDATA[620]]></SEQNO>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <AD_ELEMENT_ID><![CDATA[1891]]></AD_ELEMENT_ID>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <POSITION><![CDATA[96]]></POSITION>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--1040A945DD4048AD8D43449847A6EB11-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--1040A945DD4048AD8D43449847A6EB11--></AD_COLUMN>
+
 <!--1050C23BA102443A86AB2AF85D8F098D--><AD_COLUMN>
 <!--1050C23BA102443A86AB2AF85D8F098D-->  <AD_COLUMN_ID><![CDATA[1050C23BA102443A86AB2AF85D8F098D]]></AD_COLUMN_ID>
 <!--1050C23BA102443A86AB2AF85D8F098D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -247691,6 +247728,44 @@
 <!--129A714A729241E2ABB54C374A4031BD-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--129A714A729241E2ABB54C374A4031BD--></AD_COLUMN>
 
+<!--129F2530A63B4C7CA9AF17996732E6A4--><AD_COLUMN>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <AD_COLUMN_ID><![CDATA[129F2530A63B4C7CA9AF17996732E6A4]]></AD_COLUMN_ID>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <NAME><![CDATA[Cancelledorder]]></NAME>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <DESCRIPTION><![CDATA[Link to the order that has been cancelled]]></DESCRIPTION>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <HELP><![CDATA[Link to the order that has been cancelled]]></HELP>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <COLUMNNAME><![CDATA[Cancelledorder_id]]></COLUMNNAME>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <AD_TABLE_ID><![CDATA[259]]></AD_TABLE_ID>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <AD_REFERENCE_VALUE_ID><![CDATA[290]]></AD_REFERENCE_VALUE_ID>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <SEQNO><![CDATA[720]]></SEQNO>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <AD_ELEMENT_ID><![CDATA[EB7F6DD0A85D48AD84ED48CF6D2C3776]]></AD_ELEMENT_ID>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <POSITION><![CDATA[97]]></POSITION>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--129F2530A63B4C7CA9AF17996732E6A4-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--129F2530A63B4C7CA9AF17996732E6A4--></AD_COLUMN>
+
 <!--12ABCD6B91A348CBB09D4629CA6E707A--><AD_COLUMN>
 <!--12ABCD6B91A348CBB09D4629CA6E707A-->  <AD_COLUMN_ID><![CDATA[12ABCD6B91A348CBB09D4629CA6E707A]]></AD_COLUMN_ID>
 <!--12ABCD6B91A348CBB09D4629CA6E707A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -248196,6 +248271,42 @@
 <!--141F54DBCEDE4F18BC55A8B30220745E-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--141F54DBCEDE4F18BC55A8B30220745E--></AD_COLUMN>
 
+<!--144504467AAF4239AE435F3D867341AB--><AD_COLUMN>
+<!--144504467AAF4239AE435F3D867341AB-->  <AD_COLUMN_ID><![CDATA[144504467AAF4239AE435F3D867341AB]]></AD_COLUMN_ID>
+<!--144504467AAF4239AE435F3D867341AB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--144504467AAF4239AE435F3D867341AB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--144504467AAF4239AE435F3D867341AB-->  <NAME><![CDATA[Islocked]]></NAME>
+<!--144504467AAF4239AE435F3D867341AB-->  <COLUMNNAME><![CDATA[Islocked]]></COLUMNNAME>
+<!--144504467AAF4239AE435F3D867341AB-->  <AD_TABLE_ID><![CDATA[208]]></AD_TABLE_ID>
+<!--144504467AAF4239AE435F3D867341AB-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--144504467AAF4239AE435F3D867341AB-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--144504467AAF4239AE435F3D867341AB-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--144504467AAF4239AE435F3D867341AB-->  <SEQNO><![CDATA[830]]></SEQNO>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--144504467AAF4239AE435F3D867341AB-->  <AD_ELEMENT_ID><![CDATA[0DC2A64ABEB34DA5A7180687B56197F4]]></AD_ELEMENT_ID>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--144504467AAF4239AE435F3D867341AB-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--144504467AAF4239AE435F3D867341AB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--144504467AAF4239AE435F3D867341AB-->  <POSITION><![CDATA[126]]></POSITION>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--144504467AAF4239AE435F3D867341AB-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--144504467AAF4239AE435F3D867341AB-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--144504467AAF4239AE435F3D867341AB-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--144504467AAF4239AE435F3D867341AB-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--144504467AAF4239AE435F3D867341AB-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--144504467AAF4239AE435F3D867341AB--></AD_COLUMN>
+
 <!--14561DD2B91C4C2191931AC7C8C49579--><AD_COLUMN>
 <!--14561DD2B91C4C2191931AC7C8C49579-->  <AD_COLUMN_ID><![CDATA[14561DD2B91C4C2191931AC7C8C49579]]></AD_COLUMN_ID>
 <!--14561DD2B91C4C2191931AC7C8C49579-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -265898,6 +266009,44 @@
 <!--51C9656E43E6464FB6AA62A1E40B0411-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--51C9656E43E6464FB6AA62A1E40B0411--></AD_COLUMN>
 
+<!--51E299D6B5824EC480B524E1ED726985--><AD_COLUMN>
+<!--51E299D6B5824EC480B524E1ED726985-->  <AD_COLUMN_ID><![CDATA[51E299D6B5824EC480B524E1ED726985]]></AD_COLUMN_ID>
+<!--51E299D6B5824EC480B524E1ED726985-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--51E299D6B5824EC480B524E1ED726985-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--51E299D6B5824EC480B524E1ED726985-->  <NAME><![CDATA[Confirmcancelandreplace]]></NAME>
+<!--51E299D6B5824EC480B524E1ED726985-->  <DESCRIPTION><![CDATA[Button that confirms the temporal Order by closing it and creates a cancelled order]]></DESCRIPTION>
+<!--51E299D6B5824EC480B524E1ED726985-->  <HELP><![CDATA[Button that confirms the temporal Order by closing it and creates a cancelled order]]></HELP>
+<!--51E299D6B5824EC480B524E1ED726985-->  <COLUMNNAME><![CDATA[Confirmcancelandreplace]]></COLUMNNAME>
+<!--51E299D6B5824EC480B524E1ED726985-->  <AD_TABLE_ID><![CDATA[259]]></AD_TABLE_ID>
+<!--51E299D6B5824EC480B524E1ED726985-->  <AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID>
+<!--51E299D6B5824EC480B524E1ED726985-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--51E299D6B5824EC480B524E1ED726985-->  <SEQNO><![CDATA[710]]></SEQNO>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--51E299D6B5824EC480B524E1ED726985-->  <AD_ELEMENT_ID><![CDATA[11F2729B6B6B452F854E4A3BA8EA732B]]></AD_ELEMENT_ID>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--51E299D6B5824EC480B524E1ED726985-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--51E299D6B5824EC480B524E1ED726985-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--51E299D6B5824EC480B524E1ED726985-->  <POSITION><![CDATA[94]]></POSITION>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--51E299D6B5824EC480B524E1ED726985-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--51E299D6B5824EC480B524E1ED726985-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--51E299D6B5824EC480B524E1ED726985-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--51E299D6B5824EC480B524E1ED726985-->  <EM_OBUIAPP_PROCESS_ID><![CDATA[0C2AFAEFB67B4CB8A1429195EB119A49]]></EM_OBUIAPP_PROCESS_ID>
+<!--51E299D6B5824EC480B524E1ED726985--></AD_COLUMN>
+
 <!--521EA21E6E7577ABE040007F010016C0--><AD_COLUMN>
 <!--521EA21E6E7577ABE040007F010016C0-->  <AD_COLUMN_ID><![CDATA[521EA21E6E7577ABE040007F010016C0]]></AD_COLUMN_ID>
 <!--521EA21E6E7577ABE040007F010016C0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -268213,6 +268362,7 @@
 <!--53B4B47E0B204E20B8C0F57A27662FEF-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--53B4B47E0B204E20B8C0F57A27662FEF-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--53B4B47E0B204E20B8C0F57A27662FEF-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--53B4B47E0B204E20B8C0F57A27662FEF-->  <POSITION><![CDATA[93]]></POSITION>
 <!--53B4B47E0B204E20B8C0F57A27662FEF-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--53B4B47E0B204E20B8C0F57A27662FEF-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--53B4B47E0B204E20B8C0F57A27662FEF-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -275933,6 +276083,41 @@
 <!--57D0B86A8D514F4EB2265B6A683D936A-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--57D0B86A8D514F4EB2265B6A683D936A--></AD_COLUMN>
 
+<!--57E9885AC7E14F158A4CF1F818874AA1--><AD_COLUMN>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <AD_COLUMN_ID><![CDATA[57E9885AC7E14F158A4CF1F818874AA1]]></AD_COLUMN_ID>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <NAME><![CDATA[Birth Place]]></NAME>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <COLUMNNAME><![CDATA[Birthplace]]></COLUMNNAME>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <AD_TABLE_ID><![CDATA[291]]></AD_TABLE_ID>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <SEQNO><![CDATA[610]]></SEQNO>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <AD_ELEMENT_ID><![CDATA[F26D3514DBA84CF2897C720093BF6BEC]]></AD_ELEMENT_ID>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <POSITION><![CDATA[95]]></POSITION>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--57E9885AC7E14F158A4CF1F818874AA1-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--57E9885AC7E14F158A4CF1F818874AA1--></AD_COLUMN>
+
 <!--5807449695A38D81E040007F010127AB--><AD_COLUMN>
 <!--5807449695A38D81E040007F010127AB-->  <AD_COLUMN_ID><![CDATA[5807449695A38D81E040007F010127AB]]></AD_COLUMN_ID>
 <!--5807449695A38D81E040007F010127AB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -329730,7 +329915,7 @@
 <!--984876F99CCF4C9CA94FD365FD79F834-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--984876F99CCF4C9CA94FD365FD79F834-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--984876F99CCF4C9CA94FD365FD79F834-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--984876F99CCF4C9CA94FD365FD79F834-->  <POSITION><![CDATA[95]]></POSITION>
+<!--984876F99CCF4C9CA94FD365FD79F834-->  <POSITION><![CDATA[94]]></POSITION>
 <!--984876F99CCF4C9CA94FD365FD79F834-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--984876F99CCF4C9CA94FD365FD79F834-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--984876F99CCF4C9CA94FD365FD79F834-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -330546,6 +330731,44 @@
 <!--9ACB466C69F848F4AE2DB1393D780160-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--9ACB466C69F848F4AE2DB1393D780160--></AD_COLUMN>
 
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D--><AD_COLUMN>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <AD_COLUMN_ID><![CDATA[9AEBE3623CCD4E6F820A2EB70F2F243D]]></AD_COLUMN_ID>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <NAME><![CDATA[Cancelandreplace]]></NAME>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <DESCRIPTION><![CDATA[Button that creates a temporal duplicated order]]></DESCRIPTION>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <HELP><![CDATA[Button that creates a temporal duplicated order]]></HELP>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <COLUMNNAME><![CDATA[Cancelandreplace]]></COLUMNNAME>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <AD_TABLE_ID><![CDATA[259]]></AD_TABLE_ID>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <AD_REFERENCE_ID><![CDATA[28]]></AD_REFERENCE_ID>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <SEQNO><![CDATA[700]]></SEQNO>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <AD_ELEMENT_ID><![CDATA[5AF7D5DB814D4907B10F78961BE9EFA8]]></AD_ELEMENT_ID>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <POSITION><![CDATA[86]]></POSITION>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D-->  <EM_OBUIAPP_PROCESS_ID><![CDATA[A2FAF49712D1445ABE750315CE1B473A]]></EM_OBUIAPP_PROCESS_ID>
+<!--9AEBE3623CCD4E6F820A2EB70F2F243D--></AD_COLUMN>
+
 <!--9AFE960A44A147ECAADB875D96399AA2--><AD_COLUMN>
 <!--9AFE960A44A147ECAADB875D96399AA2-->  <AD_COLUMN_ID><![CDATA[9AFE960A44A147ECAADB875D96399AA2]]></AD_COLUMN_ID>
 <!--9AFE960A44A147ECAADB875D96399AA2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -333609,6 +333832,42 @@
 <!--A07A72989B5011DDBDC300014A62838F-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--A07A72989B5011DDBDC300014A62838F--></AD_COLUMN>
 
+<!--A07BE141EA8F449C8BE288276E0D6D56--><AD_COLUMN>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <AD_COLUMN_ID><![CDATA[A07BE141EA8F449C8BE288276E0D6D56]]></AD_COLUMN_ID>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <NAME><![CDATA[Issalediscontinued]]></NAME>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <COLUMNNAME><![CDATA[Issalediscontinued]]></COLUMNNAME>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <AD_TABLE_ID><![CDATA[208]]></AD_TABLE_ID>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <SEQNO><![CDATA[840]]></SEQNO>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <AD_ELEMENT_ID><![CDATA[ED2C3271AF604A288963A04AB5BB078C]]></AD_ELEMENT_ID>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <POSITION><![CDATA[111]]></POSITION>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--A07BE141EA8F449C8BE288276E0D6D56-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--A07BE141EA8F449C8BE288276E0D6D56--></AD_COLUMN>
+
 <!--A0895BE15FC84F7CA2BD4D6B51D8BFD1--><AD_COLUMN>
 <!--A0895BE15FC84F7CA2BD4D6B51D8BFD1-->  <AD_COLUMN_ID><![CDATA[A0895BE15FC84F7CA2BD4D6B51D8BFD1]]></AD_COLUMN_ID>
 <!--A0895BE15FC84F7CA2BD4D6B51D8BFD1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -352003,6 +352262,44 @@
 <!--C6F25057A96548A493E665727DDF7A46-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--C6F25057A96548A493E665727DDF7A46--></AD_COLUMN>
 
+<!--C724ECE5B05848489719C64111425FDB--><AD_COLUMN>
+<!--C724ECE5B05848489719C64111425FDB-->  <AD_COLUMN_ID><![CDATA[C724ECE5B05848489719C64111425FDB]]></AD_COLUMN_ID>
+<!--C724ECE5B05848489719C64111425FDB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--C724ECE5B05848489719C64111425FDB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--C724ECE5B05848489719C64111425FDB-->  <NAME><![CDATA[Replacedorderline]]></NAME>
+<!--C724ECE5B05848489719C64111425FDB-->  <DESCRIPTION><![CDATA[Link to the Order that has been replaced]]></DESCRIPTION>
+<!--C724ECE5B05848489719C64111425FDB-->  <HELP><![CDATA[Link to the Order that has been replaced]]></HELP>
+<!--C724ECE5B05848489719C64111425FDB-->  <COLUMNNAME><![CDATA[Replacedorderline_id]]></COLUMNNAME>
+<!--C724ECE5B05848489719C64111425FDB-->  <AD_TABLE_ID><![CDATA[260]]></AD_TABLE_ID>
+<!--C724ECE5B05848489719C64111425FDB-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--C724ECE5B05848489719C64111425FDB-->  <AD_REFERENCE_VALUE_ID><![CDATA[271]]></AD_REFERENCE_VALUE_ID>
+<!--C724ECE5B05848489719C64111425FDB-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--C724ECE5B05848489719C64111425FDB-->  <SEQNO><![CDATA[214]]></SEQNO>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--C724ECE5B05848489719C64111425FDB-->  <AD_ELEMENT_ID><![CDATA[BE7014D21A43412CA94D17540B8D4692]]></AD_ELEMENT_ID>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--C724ECE5B05848489719C64111425FDB-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--C724ECE5B05848489719C64111425FDB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--C724ECE5B05848489719C64111425FDB-->  <POSITION><![CDATA[68]]></POSITION>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--C724ECE5B05848489719C64111425FDB-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--C724ECE5B05848489719C64111425FDB-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--C724ECE5B05848489719C64111425FDB-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--C724ECE5B05848489719C64111425FDB-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--C724ECE5B05848489719C64111425FDB-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--C724ECE5B05848489719C64111425FDB--></AD_COLUMN>
+
 <!--C73593CD83514760916EBC58EEB5EB41--><AD_COLUMN>
 <!--C73593CD83514760916EBC58EEB5EB41-->  <AD_COLUMN_ID><![CDATA[C73593CD83514760916EBC58EEB5EB41]]></AD_COLUMN_ID>
 <!--C73593CD83514760916EBC58EEB5EB41-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -354929,6 +355226,44 @@
 <!--CB2739BEE006A0E9E040007F010023A5-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--CB2739BEE006A0E9E040007F010023A5--></AD_COLUMN>
 
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB--><AD_COLUMN>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <AD_COLUMN_ID><![CDATA[CB3A64CFC2B8471E91DBBF12A663D0FB]]></AD_COLUMN_ID>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <NAME><![CDATA[Replacedorder]]></NAME>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <DESCRIPTION><![CDATA[Link to the order that has been replaced]]></DESCRIPTION>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <HELP><![CDATA[Link to the order that has been replaced]]></HELP>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <COLUMNNAME><![CDATA[Replacedorder_id]]></COLUMNNAME>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <AD_TABLE_ID><![CDATA[259]]></AD_TABLE_ID>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <AD_REFERENCE_ID><![CDATA[18]]></AD_REFERENCE_ID>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <AD_REFERENCE_VALUE_ID><![CDATA[290]]></AD_REFERENCE_VALUE_ID>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <SEQNO><![CDATA[730]]></SEQNO>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <AD_ELEMENT_ID><![CDATA[2627023DF29E469E89105888E791393B]]></AD_ELEMENT_ID>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <POSITION><![CDATA[98]]></POSITION>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--CB3A64CFC2B8471E91DBBF12A663D0FB--></AD_COLUMN>
+
 <!--CB3B154781F840CCA73D6656027F5595--><AD_COLUMN>
 <!--CB3B154781F840CCA73D6656027F5595-->  <AD_COLUMN_ID><![CDATA[CB3B154781F840CCA73D6656027F5595]]></AD_COLUMN_ID>
 <!--CB3B154781F840CCA73D6656027F5595-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -373041,6 +373376,44 @@
 <!--F52ACA48CA874F2DA0A778A92691E8F2-->  <ALLOWED_CROSS_ORG_LINK><![CDATA[N]]></ALLOWED_CROSS_ORG_LINK>
 <!--F52ACA48CA874F2DA0A778A92691E8F2--></AD_COLUMN>
 
+<!--F54BEAEAA4C04BDD9DC1448954589ED0--><AD_COLUMN>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <AD_COLUMN_ID><![CDATA[F54BEAEAA4C04BDD9DC1448954589ED0]]></AD_COLUMN_ID>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <NAME><![CDATA[Iscancelled]]></NAME>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <DESCRIPTION><![CDATA[The Sales Order has been cancelled or cancelled and replaced.]]></DESCRIPTION>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <HELP><![CDATA[The Sales Order has been cancelled and cancelled and replaced. A new Cancellation Sales Order has been created in Closed Status and if it is replaced also a new Sales Order in Book Status has been created replacing the original one.]]></HELP>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <COLUMNNAME><![CDATA[Iscancelled]]></COLUMNNAME>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <AD_TABLE_ID><![CDATA[259]]></AD_TABLE_ID>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <SEQNO><![CDATA[740]]></SEQNO>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <AD_ELEMENT_ID><![CDATA[5BD4AC040C044BB1A5817915C0961F35]]></AD_ELEMENT_ID>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <POSITION><![CDATA[101]]></POSITION>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ALLOWSORTING><![CDATA[Y]]></ALLOWSORTING>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0-->  <ALLOWFILTERING><![CDATA[Y]]></ALLOWFILTERING>
+<!--F54BEAEAA4C04BDD9DC1448954589ED0--></AD_COLUMN>
+
 <!--F55387BA03C14531AA6A20E0AF799E1B--><AD_COLUMN>
 <!--F55387BA03C14531AA6A20E0AF799E1B-->  <AD_COLUMN_ID><![CDATA[F55387BA03C14531AA6A20E0AF799E1B]]></AD_COLUMN_ID>
 <!--F55387BA03C14531AA6A20E0AF799E1B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -21282,6 +21282,18 @@
 <!--0D1F9C2D797C49A7AA476A3047DC075A-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--0D1F9C2D797C49A7AA476A3047DC075A--></AD_ELEMENT>
 
+<!--0DC2A64ABEB34DA5A7180687B56197F4--><AD_ELEMENT>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <AD_ELEMENT_ID><![CDATA[0DC2A64ABEB34DA5A7180687B56197F4]]></AD_ELEMENT_ID>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <COLUMNNAME><![CDATA[Islocked]]></COLUMNNAME>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <NAME><![CDATA[Is Locked]]></NAME>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <PRINTNAME><![CDATA[Is Locked]]></PRINTNAME>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--0DC2A64ABEB34DA5A7180687B56197F4-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--0DC2A64ABEB34DA5A7180687B56197F4--></AD_ELEMENT>
+
 <!--0DCA4840773E45198061B6F1E5F22841--><AD_ELEMENT>
 <!--0DCA4840773E45198061B6F1E5F22841-->  <AD_ELEMENT_ID><![CDATA[0DCA4840773E45198061B6F1E5F22841]]></AD_ELEMENT_ID>
 <!--0DCA4840773E45198061B6F1E5F22841-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -21429,6 +21441,20 @@
 <!--11C2BC5D35EE4A098C6C99FE71F06590-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--11C2BC5D35EE4A098C6C99FE71F06590--></AD_ELEMENT>
 
+<!--11F2729B6B6B452F854E4A3BA8EA732B--><AD_ELEMENT>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <AD_ELEMENT_ID><![CDATA[11F2729B6B6B452F854E4A3BA8EA732B]]></AD_ELEMENT_ID>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <COLUMNNAME><![CDATA[Confirmcancelandreplace]]></COLUMNNAME>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <NAME><![CDATA[Confirm Cancel and Replace]]></NAME>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <PRINTNAME><![CDATA[Confirm Cancel and Replace]]></PRINTNAME>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <DESCRIPTION><![CDATA[Button that confirms the temporal Order by closing it and creates a cancelled order]]></DESCRIPTION>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <HELP><![CDATA[Button that confirms the temporal Order by closing it and creates a cancelled order]]></HELP>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--11F2729B6B6B452F854E4A3BA8EA732B-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--11F2729B6B6B452F854E4A3BA8EA732B--></AD_ELEMENT>
+
 <!--13338440A6404E389A502A20DCDDF226--><AD_ELEMENT>
 <!--13338440A6404E389A502A20DCDDF226-->  <AD_ELEMENT_ID><![CDATA[13338440A6404E389A502A20DCDDF226]]></AD_ELEMENT_ID>
 <!--13338440A6404E389A502A20DCDDF226-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -22013,6 +22039,20 @@
 <!--24DF09C68AD04D86963F5DE05B759600-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--24DF09C68AD04D86963F5DE05B759600--></AD_ELEMENT>
 
+<!--2627023DF29E469E89105888E791393B--><AD_ELEMENT>
+<!--2627023DF29E469E89105888E791393B-->  <AD_ELEMENT_ID><![CDATA[2627023DF29E469E89105888E791393B]]></AD_ELEMENT_ID>
+<!--2627023DF29E469E89105888E791393B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--2627023DF29E469E89105888E791393B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--2627023DF29E469E89105888E791393B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--2627023DF29E469E89105888E791393B-->  <COLUMNNAME><![CDATA[Replacedorder_id]]></COLUMNNAME>
+<!--2627023DF29E469E89105888E791393B-->  <NAME><![CDATA[Replaced Order]]></NAME>
+<!--2627023DF29E469E89105888E791393B-->  <PRINTNAME><![CDATA[Replaced Order]]></PRINTNAME>
+<!--2627023DF29E469E89105888E791393B-->  <DESCRIPTION><![CDATA[Link to the order that has been replaced]]></DESCRIPTION>
+<!--2627023DF29E469E89105888E791393B-->  <HELP><![CDATA[Link to the order that has been replaced]]></HELP>
+<!--2627023DF29E469E89105888E791393B-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--2627023DF29E469E89105888E791393B-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--2627023DF29E469E89105888E791393B--></AD_ELEMENT>
+
 <!--267A3D0068D048C2991366C96CB19590--><AD_ELEMENT>
 <!--267A3D0068D048C2991366C96CB19590-->  <AD_ELEMENT_ID><![CDATA[267A3D0068D048C2991366C96CB19590]]></AD_ELEMENT_ID>
 <!--267A3D0068D048C2991366C96CB19590-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -25598,6 +25638,20 @@
 <!--5ACB703E0038CD12E040007F010160B4-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--5ACB703E0038CD12E040007F010160B4--></AD_ELEMENT>
 
+<!--5AF7D5DB814D4907B10F78961BE9EFA8--><AD_ELEMENT>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <AD_ELEMENT_ID><![CDATA[5AF7D5DB814D4907B10F78961BE9EFA8]]></AD_ELEMENT_ID>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <COLUMNNAME><![CDATA[Cancelandreplace]]></COLUMNNAME>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <NAME><![CDATA[Cancel and Replace]]></NAME>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <PRINTNAME><![CDATA[Cancel and Replace]]></PRINTNAME>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <DESCRIPTION><![CDATA[Button that creates a temporal duplicated order]]></DESCRIPTION>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <HELP><![CDATA[Button that creates a temporal duplicated order]]></HELP>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--5AF7D5DB814D4907B10F78961BE9EFA8--></AD_ELEMENT>
+
 <!--5AFB22E6D5924B6DBE8F5C4FE839A5AE--><AD_ELEMENT>
 <!--5AFB22E6D5924B6DBE8F5C4FE839A5AE-->  <AD_ELEMENT_ID><![CDATA[5AFB22E6D5924B6DBE8F5C4FE839A5AE]]></AD_ELEMENT_ID>
 <!--5AFB22E6D5924B6DBE8F5C4FE839A5AE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -25654,6 +25708,20 @@
 <!--5BCA37B278504F459215615AABC0BF2C-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--5BCA37B278504F459215615AABC0BF2C--></AD_ELEMENT>
 
+<!--5BD4AC040C044BB1A5817915C0961F35--><AD_ELEMENT>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <AD_ELEMENT_ID><![CDATA[5BD4AC040C044BB1A5817915C0961F35]]></AD_ELEMENT_ID>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <COLUMNNAME><![CDATA[Iscancelled]]></COLUMNNAME>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <NAME><![CDATA[Is Cancelled]]></NAME>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <PRINTNAME><![CDATA[Is Cancelled]]></PRINTNAME>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <DESCRIPTION><![CDATA[The Sales Order has been cancelled or cancelled and replaced.]]></DESCRIPTION>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <HELP><![CDATA[The Sales Order has been cancelled and cancelled and replaced. A new Cancellation Sales Order has been created in Closed Status and if it is replaced also a new Sales Order in Book Status has been created replacing the original one.]]></HELP>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--5BD4AC040C044BB1A5817915C0961F35-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--5BD4AC040C044BB1A5817915C0961F35--></AD_ELEMENT>
+
 <!--5BE187236833538BE040007F010169BF--><AD_ELEMENT>
 <!--5BE187236833538BE040007F010169BF-->  <AD_ELEMENT_ID><![CDATA[5BE187236833538BE040007F010169BF]]></AD_ELEMENT_ID>
 <!--5BE187236833538BE040007F010169BF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -31792,6 +31860,20 @@
 <!--BDC51EB4B3284866A2919ED98022A14F-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--BDC51EB4B3284866A2919ED98022A14F--></AD_ELEMENT>
 
+<!--BE7014D21A43412CA94D17540B8D4692--><AD_ELEMENT>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <AD_ELEMENT_ID><![CDATA[BE7014D21A43412CA94D17540B8D4692]]></AD_ELEMENT_ID>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <COLUMNNAME><![CDATA[Replacedorderline_id]]></COLUMNNAME>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <NAME><![CDATA[Replaced Order Line]]></NAME>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <PRINTNAME><![CDATA[Replaced Order Line]]></PRINTNAME>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <DESCRIPTION><![CDATA[Link to the Order that has been replaced]]></DESCRIPTION>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <HELP><![CDATA[Link to the Order that has been replaced]]></HELP>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--BE7014D21A43412CA94D17540B8D4692-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--BE7014D21A43412CA94D17540B8D4692--></AD_ELEMENT>
+
 <!--BEADA4ABFE544524B69FEC20E82F2D95--><AD_ELEMENT>
 <!--BEADA4ABFE544524B69FEC20E82F2D95-->  <AD_ELEMENT_ID><![CDATA[BEADA4ABFE544524B69FEC20E82F2D95]]></AD_ELEMENT_ID>
 <!--BEADA4ABFE544524B69FEC20E82F2D95-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -33993,6 +34075,20 @@
 <!--EB58AFE2D52942FEA4B7DA407282DC1D-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--EB58AFE2D52942FEA4B7DA407282DC1D--></AD_ELEMENT>
 
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776--><AD_ELEMENT>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <AD_ELEMENT_ID><![CDATA[EB7F6DD0A85D48AD84ED48CF6D2C3776]]></AD_ELEMENT_ID>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <COLUMNNAME><![CDATA[Cancelledorder_id]]></COLUMNNAME>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <NAME><![CDATA[Cancelled Order]]></NAME>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <PRINTNAME><![CDATA[Cancelled Order]]></PRINTNAME>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <DESCRIPTION><![CDATA[Link to the order that has been cancelled]]></DESCRIPTION>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <HELP><![CDATA[Link to the order that has been cancelled]]></HELP>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--EB7F6DD0A85D48AD84ED48CF6D2C3776--></AD_ELEMENT>
+
 <!--EBE913C1DDD84066A1D88C9903717DB9--><AD_ELEMENT>
 <!--EBE913C1DDD84066A1D88C9903717DB9-->  <AD_ELEMENT_ID><![CDATA[EBE913C1DDD84066A1D88C9903717DB9]]></AD_ELEMENT_ID>
 <!--EBE913C1DDD84066A1D88C9903717DB9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -34033,6 +34129,20 @@
 <!--ECAC136184A746C39804BD71BC3C78DB-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--ECAC136184A746C39804BD71BC3C78DB--></AD_ELEMENT>
 
+<!--ED2C3271AF604A288963A04AB5BB078C--><AD_ELEMENT>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <AD_ELEMENT_ID><![CDATA[ED2C3271AF604A288963A04AB5BB078C]]></AD_ELEMENT_ID>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <COLUMNNAME><![CDATA[Issalediscontinued]]></COLUMNNAME>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <NAME><![CDATA[Is Discontinued]]></NAME>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <PRINTNAME><![CDATA[Is Discontinued]]></PRINTNAME>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <DESCRIPTION><![CDATA[A statement mentioning that this product will no longer be available on the market.]]></DESCRIPTION>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <HELP><![CDATA[The Discontinued check box indicates a product that has been discontinued.]]></HELP>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ED2C3271AF604A288963A04AB5BB078C-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--ED2C3271AF604A288963A04AB5BB078C--></AD_ELEMENT>
+
 <!--ED51BE55711947E18F566818EC704CAB--><AD_ELEMENT>
 <!--ED51BE55711947E18F566818EC704CAB-->  <AD_ELEMENT_ID><![CDATA[ED51BE55711947E18F566818EC704CAB]]></AD_ELEMENT_ID>
 <!--ED51BE55711947E18F566818EC704CAB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -34192,6 +34302,18 @@
 <!--F2351D18492C42A6AE6F01F74831D617-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--F2351D18492C42A6AE6F01F74831D617--></AD_ELEMENT>
 
+<!--F26D3514DBA84CF2897C720093BF6BEC--><AD_ELEMENT>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <AD_ELEMENT_ID><![CDATA[F26D3514DBA84CF2897C720093BF6BEC]]></AD_ELEMENT_ID>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <COLUMNNAME><![CDATA[Birthplace]]></COLUMNNAME>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <NAME><![CDATA[Birth Place]]></NAME>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <PRINTNAME><![CDATA[Birth Place]]></PRINTNAME>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--F26D3514DBA84CF2897C720093BF6BEC-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--F26D3514DBA84CF2897C720093BF6BEC--></AD_ELEMENT>
+
 <!--F2D48C18F40D4F1AB4EB9B42BDC76004--><AD_ELEMENT>
 <!--F2D48C18F40D4F1AB4EB9B42BDC76004-->  <AD_ELEMENT_ID><![CDATA[F2D48C18F40D4F1AB4EB9B42BDC76004]]></AD_ELEMENT_ID>
 <!--F2D48C18F40D4F1AB4EB9B42BDC76004-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -14412,7 +14412,7 @@
 <!--1083-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
 <!--1083-->  <AD_FIELDGROUP_ID><![CDATA[101]]></AD_FIELDGROUP_ID>
 <!--1083-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
-<!--1083-->  <DISPLAYLOGIC><![CDATA[@DocStatus@!'VO'&@DocStatus@!'CL']]></DISPLAYLOGIC>
+<!--1083-->  <DISPLAYLOGIC><![CDATA[@DocStatus@!'VO'&@DocStatus@!'CL'&@DocStatus@!'TMP']]></DISPLAYLOGIC>
 <!--1083-->  <DISPLAYLENGTH><![CDATA[23]]></DISPLAYLENGTH>
 <!--1083-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
 <!--1083-->  <SEQNO><![CDATA[336]]></SEQNO>
@@ -180061,6 +180061,34 @@
 <!--059F7231F8A246A585FD4E2E503FC1ED-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--059F7231F8A246A585FD4E2E503FC1ED--></AD_FIELD>
 
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9--><AD_FIELD>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <AD_FIELD_ID><![CDATA[05E7C043CEC5432EBAFF1F3FD71A05E9]]></AD_FIELD_ID>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <NAME><![CDATA[Is Cancelled]]></NAME>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <DESCRIPTION><![CDATA[The Sales Order has been cancelled or cancelled and replaced.]]></DESCRIPTION>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <HELP><![CDATA[The Sales Order has been cancelled and cancelled and replaced. A new Cancellation Sales Order has been created in Closed Status and if it is replaced also a new Sales Order in Book Status has been created replacing the original one.]]></HELP>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <AD_TAB_ID><![CDATA[186]]></AD_TAB_ID>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <AD_COLUMN_ID><![CDATA[F54BEAEAA4C04BDD9DC1448954589ED0]]></AD_COLUMN_ID>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <SEQNO><![CDATA[135]]></SEQNO>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--05E7C043CEC5432EBAFF1F3FD71A05E9--></AD_FIELD>
+
 <!--06005FA0890493DAE050007F01006246--><AD_FIELD>
 <!--06005FA0890493DAE050007F01006246-->  <AD_FIELD_ID><![CDATA[06005FA0890493DAE050007F01006246]]></AD_FIELD_ID>
 <!--06005FA0890493DAE050007F01006246-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -202093,6 +202121,35 @@
 <!--3C0B7FD069C24F40AB9CA1F21DB182F4-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--3C0B7FD069C24F40AB9CA1F21DB182F4--></AD_FIELD>
 
+<!--3C2B8257EC414EFBB6BA098C8400D28A--><AD_FIELD>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <AD_FIELD_ID><![CDATA[3C2B8257EC414EFBB6BA098C8400D28A]]></AD_FIELD_ID>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <NAME><![CDATA[Cancelled Order]]></NAME>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <DESCRIPTION><![CDATA[Link to the order that has been cancelled]]></DESCRIPTION>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <HELP><![CDATA[Link to the order that has been cancelled]]></HELP>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <AD_TAB_ID><![CDATA[186]]></AD_TAB_ID>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <AD_COLUMN_ID><![CDATA[129F2530A63B4C7CA9AF17996732E6A4]]></AD_COLUMN_ID>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <DISPLAYLOGIC><![CDATA[@Cancelledorder_id@!'']]></DISPLAYLOGIC>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <SEQNO><![CDATA[125]]></SEQNO>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--3C2B8257EC414EFBB6BA098C8400D28A-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--3C2B8257EC414EFBB6BA098C8400D28A--></AD_FIELD>
+
 <!--3C42EE919FD647FEAD42BA89899FCB0F--><AD_FIELD>
 <!--3C42EE919FD647FEAD42BA89899FCB0F-->  <AD_FIELD_ID><![CDATA[3C42EE919FD647FEAD42BA89899FCB0F]]></AD_FIELD_ID>
 <!--3C42EE919FD647FEAD42BA89899FCB0F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -202319,6 +202376,35 @@
 <!--3C9B4A09C20D453FAFD2E8A768B71324-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--3C9B4A09C20D453FAFD2E8A768B71324--></AD_FIELD>
 
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73--><AD_FIELD>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <AD_FIELD_ID><![CDATA[3C9B97CD980A4D809BDE5B9FDC3E0E73]]></AD_FIELD_ID>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <NAME><![CDATA[Cancel and Replace]]></NAME>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <DESCRIPTION><![CDATA[Button that creates a temporal duplicated order]]></DESCRIPTION>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <HELP><![CDATA[Button that creates a temporal duplicated order]]></HELP>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <AD_TAB_ID><![CDATA[186]]></AD_TAB_ID>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <AD_COLUMN_ID><![CDATA[9AEBE3623CCD4E6F820A2EB70F2F243D]]></AD_COLUMN_ID>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <DISPLAYLOGIC><![CDATA[@DocStatus@='CO'&@Cancelledorder_id@=''&@Replacedorder_id@=''&@Iscancelled@='N']]></DISPLAYLOGIC>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <SEQNO><![CDATA[2140]]></SEQNO>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--3C9B97CD980A4D809BDE5B9FDC3E0E73--></AD_FIELD>
+
 <!--3C9BD03FD58E4B32AD993C9712287066--><AD_FIELD>
 <!--3C9BD03FD58E4B32AD993C9712287066-->  <AD_FIELD_ID><![CDATA[3C9BD03FD58E4B32AD993C9712287066]]></AD_FIELD_ID>
 <!--3C9BD03FD58E4B32AD993C9712287066-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -235232,6 +235318,35 @@
 <!--75D3E53684774A14B665838D7CCC33A7-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--75D3E53684774A14B665838D7CCC33A7--></AD_FIELD>
 
+<!--75E4E471100E45848F478AF51CDAA9CD--><AD_FIELD>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <AD_FIELD_ID><![CDATA[75E4E471100E45848F478AF51CDAA9CD]]></AD_FIELD_ID>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <NAME><![CDATA[Birthday]]></NAME>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <DESCRIPTION><![CDATA[An anniversary of birth for a business partner.]]></DESCRIPTION>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <HELP><![CDATA[Birthday or Anniversary day]]></HELP>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <AD_TAB_ID><![CDATA[223]]></AD_TAB_ID>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <AD_COLUMN_ID><![CDATA[1040A945DD4048AD8D43449847A6EB11]]></AD_COLUMN_ID>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <DISPLAYLENGTH><![CDATA[0]]></DISPLAYLENGTH>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <SEQNO><![CDATA[250]]></SEQNO>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <GRID_SEQNO><![CDATA[140]]></GRID_SEQNO>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--75E4E471100E45848F478AF51CDAA9CD-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--75E4E471100E45848F478AF51CDAA9CD--></AD_FIELD>
+
 <!--7642953AF81F461AB6A96DA9E7F674E6--><AD_FIELD>
 <!--7642953AF81F461AB6A96DA9E7F674E6-->  <AD_FIELD_ID><![CDATA[7642953AF81F461AB6A96DA9E7F674E6]]></AD_FIELD_ID>
 <!--7642953AF81F461AB6A96DA9E7F674E6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -259314,6 +259429,33 @@
 <!--9BAC7BA6402349F8A61278B294455995-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--9BAC7BA6402349F8A61278B294455995--></AD_FIELD>
 
+<!--9BB870215141401B985071094B6E1F44--><AD_FIELD>
+<!--9BB870215141401B985071094B6E1F44-->  <AD_FIELD_ID><![CDATA[9BB870215141401B985071094B6E1F44]]></AD_FIELD_ID>
+<!--9BB870215141401B985071094B6E1F44-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9BB870215141401B985071094B6E1F44-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9BB870215141401B985071094B6E1F44-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9BB870215141401B985071094B6E1F44-->  <NAME><![CDATA[Is Discontinued]]></NAME>
+<!--9BB870215141401B985071094B6E1F44-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--9BB870215141401B985071094B6E1F44-->  <AD_TAB_ID><![CDATA[180]]></AD_TAB_ID>
+<!--9BB870215141401B985071094B6E1F44-->  <AD_COLUMN_ID><![CDATA[A07BE141EA8F449C8BE288276E0D6D56]]></AD_COLUMN_ID>
+<!--9BB870215141401B985071094B6E1F44-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--9BB870215141401B985071094B6E1F44-->  <AD_FIELDGROUP_ID><![CDATA[FF8081813321B791013321CF8357005D]]></AD_FIELDGROUP_ID>
+<!--9BB870215141401B985071094B6E1F44-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--9BB870215141401B985071094B6E1F44-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--9BB870215141401B985071094B6E1F44-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--9BB870215141401B985071094B6E1F44-->  <SEQNO><![CDATA[680]]></SEQNO>
+<!--9BB870215141401B985071094B6E1F44-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--9BB870215141401B985071094B6E1F44-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--9BB870215141401B985071094B6E1F44-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--9BB870215141401B985071094B6E1F44-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--9BB870215141401B985071094B6E1F44-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--9BB870215141401B985071094B6E1F44-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9BB870215141401B985071094B6E1F44-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--9BB870215141401B985071094B6E1F44-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--9BB870215141401B985071094B6E1F44-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--9BB870215141401B985071094B6E1F44-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--9BB870215141401B985071094B6E1F44--></AD_FIELD>
+
 <!--9BD9B98ED54E43F7B357097799E9A2C6--><AD_FIELD>
 <!--9BD9B98ED54E43F7B357097799E9A2C6-->  <AD_FIELD_ID><![CDATA[9BD9B98ED54E43F7B357097799E9A2C6]]></AD_FIELD_ID>
 <!--9BD9B98ED54E43F7B357097799E9A2C6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -266307,6 +266449,33 @@
 <!--ADDA9474A23F4C0182BB3BE4EAA6B87C-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--ADDA9474A23F4C0182BB3BE4EAA6B87C--></AD_FIELD>
 
+<!--ADE41D125D2143F49177E058C42B3883--><AD_FIELD>
+<!--ADE41D125D2143F49177E058C42B3883-->  <AD_FIELD_ID><![CDATA[ADE41D125D2143F49177E058C42B3883]]></AD_FIELD_ID>
+<!--ADE41D125D2143F49177E058C42B3883-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--ADE41D125D2143F49177E058C42B3883-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--ADE41D125D2143F49177E058C42B3883-->  <NAME><![CDATA[Birth Place]]></NAME>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--ADE41D125D2143F49177E058C42B3883-->  <AD_TAB_ID><![CDATA[223]]></AD_TAB_ID>
+<!--ADE41D125D2143F49177E058C42B3883-->  <AD_COLUMN_ID><![CDATA[57E9885AC7E14F158A4CF1F818874AA1]]></AD_COLUMN_ID>
+<!--ADE41D125D2143F49177E058C42B3883-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--ADE41D125D2143F49177E058C42B3883-->  <DISPLAYLENGTH><![CDATA[0]]></DISPLAYLENGTH>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--ADE41D125D2143F49177E058C42B3883-->  <SEQNO><![CDATA[260]]></SEQNO>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--ADE41D125D2143F49177E058C42B3883-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--ADE41D125D2143F49177E058C42B3883-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--ADE41D125D2143F49177E058C42B3883-->  <GRID_SEQNO><![CDATA[150]]></GRID_SEQNO>
+<!--ADE41D125D2143F49177E058C42B3883-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--ADE41D125D2143F49177E058C42B3883-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--ADE41D125D2143F49177E058C42B3883-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--ADE41D125D2143F49177E058C42B3883-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--ADE41D125D2143F49177E058C42B3883--></AD_FIELD>
+
 <!--ADEA0D5288604FF88E1D4CBD393D1758--><AD_FIELD>
 <!--ADEA0D5288604FF88E1D4CBD393D1758-->  <AD_FIELD_ID><![CDATA[ADEA0D5288604FF88E1D4CBD393D1758]]></AD_FIELD_ID>
 <!--ADEA0D5288604FF88E1D4CBD393D1758-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -292278,6 +292447,33 @@
 <!--D165BBBE0F3E4EE9BDE264D5E8FE6903-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--D165BBBE0F3E4EE9BDE264D5E8FE6903--></AD_FIELD>
 
+<!--D16604DCA24A428C9C40F67BD116B234--><AD_FIELD>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <AD_FIELD_ID><![CDATA[D16604DCA24A428C9C40F67BD116B234]]></AD_FIELD_ID>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <NAME><![CDATA[Is Locked]]></NAME>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <AD_TAB_ID><![CDATA[180]]></AD_TAB_ID>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <AD_COLUMN_ID><![CDATA[144504467AAF4239AE435F3D867341AB]]></AD_COLUMN_ID>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <AD_FIELDGROUP_ID><![CDATA[FF8081813321B791013321CF8357005D]]></AD_FIELDGROUP_ID>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <SEQNO><![CDATA[670]]></SEQNO>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--D16604DCA24A428C9C40F67BD116B234-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--D16604DCA24A428C9C40F67BD116B234--></AD_FIELD>
+
 <!--D16BDA21D4824DF7BC9760FD5B24455B--><AD_FIELD>
 <!--D16BDA21D4824DF7BC9760FD5B24455B-->  <AD_FIELD_ID><![CDATA[D16BDA21D4824DF7BC9760FD5B24455B]]></AD_FIELD_ID>
 <!--D16BDA21D4824DF7BC9760FD5B24455B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -300208,6 +300404,35 @@
 <!--E021828CBBA74A29B77D98B771B9A81D-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--E021828CBBA74A29B77D98B771B9A81D--></AD_FIELD>
 
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6--><AD_FIELD>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <AD_FIELD_ID><![CDATA[E03B2279B7F54EE1BDCDCD21D2AFF7F6]]></AD_FIELD_ID>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <NAME><![CDATA[Replaced Order Line]]></NAME>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <DESCRIPTION><![CDATA[Link to the Order that has been replaced]]></DESCRIPTION>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <HELP><![CDATA[Link to the Order that has been replaced]]></HELP>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <AD_TAB_ID><![CDATA[187]]></AD_TAB_ID>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <AD_COLUMN_ID><![CDATA[C724ECE5B05848489719C64111425FDB]]></AD_COLUMN_ID>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <DISPLAYLOGIC><![CDATA[@Replacedorderline_id@!'']]></DISPLAYLOGIC>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <SEQNO><![CDATA[111]]></SEQNO>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--E03B2279B7F54EE1BDCDCD21D2AFF7F6--></AD_FIELD>
+
 <!--E04D2AFD798A471F86057AE158BF854F--><AD_FIELD>
 <!--E04D2AFD798A471F86057AE158BF854F-->  <AD_FIELD_ID><![CDATA[E04D2AFD798A471F86057AE158BF854F]]></AD_FIELD_ID>
 <!--E04D2AFD798A471F86057AE158BF854F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -302848,6 +303073,35 @@
 <!--E71F2C217A324DE397F8527BFB2513C3-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--E71F2C217A324DE397F8527BFB2513C3--></AD_FIELD>
 
+<!--E7336543F2EA4658A48B719F833D43B6--><AD_FIELD>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <AD_FIELD_ID><![CDATA[E7336543F2EA4658A48B719F833D43B6]]></AD_FIELD_ID>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <NAME><![CDATA[Replaced Order]]></NAME>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <DESCRIPTION><![CDATA[Link to the order that has been replaced]]></DESCRIPTION>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <HELP><![CDATA[Link to the order that has been replaced]]></HELP>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <AD_TAB_ID><![CDATA[186]]></AD_TAB_ID>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <AD_COLUMN_ID><![CDATA[CB3A64CFC2B8471E91DBBF12A663D0FB]]></AD_COLUMN_ID>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <DISPLAYLOGIC><![CDATA[@Replacedorder_id@!'']]></DISPLAYLOGIC>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISREADONLY><![CDATA[Y]]></ISREADONLY>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <SEQNO><![CDATA[130]]></SEQNO>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--E7336543F2EA4658A48B719F833D43B6-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--E7336543F2EA4658A48B719F833D43B6--></AD_FIELD>
+
 <!--E73474C229524EFEA43AB9F6462E49A8--><AD_FIELD>
 <!--E73474C229524EFEA43AB9F6462E49A8-->  <AD_FIELD_ID><![CDATA[E73474C229524EFEA43AB9F6462E49A8]]></AD_FIELD_ID>
 <!--E73474C229524EFEA43AB9F6462E49A8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -306494,6 +306748,35 @@
 <!--F0A3A82183604553A1DB29504DBA1F45-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--F0A3A82183604553A1DB29504DBA1F45--></AD_FIELD>
 
+<!--F0BF2E4561024D30B93AC7B471DBF5D7--><AD_FIELD>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <AD_FIELD_ID><![CDATA[F0BF2E4561024D30B93AC7B471DBF5D7]]></AD_FIELD_ID>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <NAME><![CDATA[Confirm Cancel and Replace]]></NAME>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <DESCRIPTION><![CDATA[Button that confirms the temporal Order by closing it and creates a cancelled order]]></DESCRIPTION>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <HELP><![CDATA[Button that confirms the temporal Order by closing it and creates a cancelled order]]></HELP>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <AD_TAB_ID><![CDATA[186]]></AD_TAB_ID>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <AD_COLUMN_ID><![CDATA[51E299D6B5824EC480B524E1ED726985]]></AD_COLUMN_ID>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <DISPLAYLOGIC><![CDATA[@DocStatus@='TMP']]></DISPLAYLOGIC>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <SEQNO><![CDATA[2160]]></SEQNO>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--F0BF2E4561024D30B93AC7B471DBF5D7--></AD_FIELD>
+
 <!--F0D198AB8059467299309D4DA1506A8E--><AD_FIELD>
 <!--F0D198AB8059467299309D4DA1506A8E-->  <AD_FIELD_ID><![CDATA[F0D198AB8059467299309D4DA1506A8E]]></AD_FIELD_ID>
 <!--F0D198AB8059467299309D4DA1506A8E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -17471,6 +17471,18 @@
 <!--234443E5BAB34ABC892AFDE05F9C229D-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--234443E5BAB34ABC892AFDE05F9C229D--></AD_MESSAGE>
 
+<!--238EDDD594F24F06BCFC6F8F81506369--><AD_MESSAGE>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <AD_MESSAGE_ID><![CDATA[238EDDD594F24F06BCFC6F8F81506369]]></AD_MESSAGE_ID>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <VALUE><![CDATA[CannotUseDiscontinuedProduct]]></VALUE>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <MSGTEXT><![CDATA[It is not possible to sell the product]]></MSGTEXT>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--238EDDD594F24F06BCFC6F8F81506369-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--238EDDD594F24F06BCFC6F8F81506369--></AD_MESSAGE>
+
 <!--239B36AC9A144464861B1E76C83A07E9--><AD_MESSAGE>
 <!--239B36AC9A144464861B1E76C83A07E9-->  <AD_MESSAGE_ID><![CDATA[239B36AC9A144464861B1E76C83A07E9]]></AD_MESSAGE_ID>
 <!--239B36AC9A144464861B1E76C83A07E9-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -18283,6 +18295,18 @@
 <!--338EF3E59A594EFC807843510BDEAF46-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--338EF3E59A594EFC807843510BDEAF46--></AD_MESSAGE>
 
+<!--33D53B7E00874B2E8DF895D25394C213--><AD_MESSAGE>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <AD_MESSAGE_ID><![CDATA[33D53B7E00874B2E8DF895D25394C213]]></AD_MESSAGE_ID>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <VALUE><![CDATA[OrderCreatedInTemporalStatus]]></VALUE>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <MSGTEXT><![CDATA[New replacing order created in Temporal status:]]></MSGTEXT>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--33D53B7E00874B2E8DF895D25394C213-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--33D53B7E00874B2E8DF895D25394C213--></AD_MESSAGE>
+
 <!--33ED747B6F0B4F27B0000B5F1818F8BB--><AD_MESSAGE>
 <!--33ED747B6F0B4F27B0000B5F1818F8BB-->  <AD_MESSAGE_ID><![CDATA[33ED747B6F0B4F27B0000B5F1818F8BB]]></AD_MESSAGE_ID>
 <!--33ED747B6F0B4F27B0000B5F1818F8BB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -22143,6 +22167,18 @@
 <!--86C6EA2CC6C80848E040007F0101395B-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--86C6EA2CC6C80848E040007F0101395B--></AD_MESSAGE>
 
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045--><AD_MESSAGE>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <AD_MESSAGE_ID><![CDATA[86CE6F5472AC4CC3A3AB1E1B0FAE3045]]></AD_MESSAGE_ID>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <ISACTIVE><![CDATA[N]]></ISACTIVE>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <VALUE><![CDATA[ProductDiscontinuedNoStock]]></VALUE>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <MSGTEXT><![CDATA[This product is discontinued and there is not enough stock available ]]></MSGTEXT>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--86CE6F5472AC4CC3A3AB1E1B0FAE3045--></AD_MESSAGE>
+
 <!--873B575159384E1CAB008991116622BF--><AD_MESSAGE>
 <!--873B575159384E1CAB008991116622BF-->  <AD_MESSAGE_ID><![CDATA[873B575159384E1CAB008991116622BF]]></AD_MESSAGE_ID>
 <!--873B575159384E1CAB008991116622BF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -25809,6 +25845,18 @@
 <!--D65C94634D5F43689B97009352C44322-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--D65C94634D5F43689B97009352C44322--></AD_MESSAGE>
 
+<!--D65DD460608A487DB560B9EE0670CE31--><AD_MESSAGE>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <AD_MESSAGE_ID><![CDATA[D65DD460608A487DB560B9EE0670CE31]]></AD_MESSAGE_ID>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <VALUE><![CDATA[OrderInTemporalStatus]]></VALUE>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <MSGTEXT><![CDATA[Order in Temporal Status]]></MSGTEXT>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <MSGTYPE><![CDATA[I]]></MSGTYPE>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--D65DD460608A487DB560B9EE0670CE31-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--D65DD460608A487DB560B9EE0670CE31--></AD_MESSAGE>
+
 <!--D668C08F61EE4DCBA55E383321D3676E--><AD_MESSAGE>
 <!--D668C08F61EE4DCBA55E383321D3676E-->  <AD_MESSAGE_ID><![CDATA[D668C08F61EE4DCBA55E383321D3676E]]></AD_MESSAGE_ID>
 <!--D668C08F61EE4DCBA55E383321D3676E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -25977,6 +26025,18 @@
 <!--D84A9308B4674840AB3D78817A6A884D-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--D84A9308B4674840AB3D78817A6A884D--></AD_MESSAGE>
 
+<!--D8572076F54540029247226D6B4D115C--><AD_MESSAGE>
+<!--D8572076F54540029247226D6B4D115C-->  <AD_MESSAGE_ID><![CDATA[D8572076F54540029247226D6B4D115C]]></AD_MESSAGE_ID>
+<!--D8572076F54540029247226D6B4D115C-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--D8572076F54540029247226D6B4D115C-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--D8572076F54540029247226D6B4D115C-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--D8572076F54540029247226D6B4D115C-->  <VALUE><![CDATA[IsCancelled]]></VALUE>
+<!--D8572076F54540029247226D6B4D115C-->  <MSGTEXT><![CDATA[has been already Cancelled]]></MSGTEXT>
+<!--D8572076F54540029247226D6B4D115C-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--D8572076F54540029247226D6B4D115C-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--D8572076F54540029247226D6B4D115C-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--D8572076F54540029247226D6B4D115C--></AD_MESSAGE>
+
 <!--D9912E810888475ABB8DFF416196FB5E--><AD_MESSAGE>
 <!--D9912E810888475ABB8DFF416196FB5E-->  <AD_MESSAGE_ID><![CDATA[D9912E810888475ABB8DFF416196FB5E]]></AD_MESSAGE_ID>
 <!--D9912E810888475ABB8DFF416196FB5E-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -26956,6 +27016,18 @@
 <!--EE9607236B3A4C2A9703BF97A73927E1-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
 <!--EE9607236B3A4C2A9703BF97A73927E1--></AD_MESSAGE>
 
+<!--EEC39B15885B4D1387F25EFBC6205CE8--><AD_MESSAGE>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <AD_MESSAGE_ID><![CDATA[EEC39B15885B4D1387F25EFBC6205CE8]]></AD_MESSAGE_ID>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <VALUE><![CDATA[CannotUseLockedProduct]]></VALUE>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <MSGTEXT><![CDATA[It is not possible to sell the locked product]]></MSGTEXT>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--EEC39B15885B4D1387F25EFBC6205CE8-->  <ISINCLUDEINI18N><![CDATA[N]]></ISINCLUDEINI18N>
+<!--EEC39B15885B4D1387F25EFBC6205CE8--></AD_MESSAGE>
+
 <!--EF6ECE31E8474A289803BC07D3774F17--><AD_MESSAGE>
 <!--EF6ECE31E8474A289803BC07D3774F17-->  <AD_MESSAGE_ID><![CDATA[EF6ECE31E8474A289803BC07D3774F17]]></AD_MESSAGE_ID>
 <!--EF6ECE31E8474A289803BC07D3774F17-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_PROCESS.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/AD_PROCESS.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -506,7 +506,7 @@
 <!--122-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
 <!--122-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--122-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
-<!--122-->  <VALUE><![CDATA[M_Movement_Post]]></VALUE>
+<!--122-->  <VALUE><![CDATA[M_Movement_Post0]]></VALUE>
 <!--122-->  <NAME><![CDATA[Process Movements]]></NAME>
 <!--122-->  <DESCRIPTION><![CDATA[Process Inventory Movements]]></DESCRIPTION>
 <!--122-->  <HELP><![CDATA[Process Inventory Movements will update inventory quantities based on the defined movements between warehouses or locations.]]></HELP>
--- a/src-db/database/sourcedata/AD_REF_LIST.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/AD_REF_LIST.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -12372,6 +12372,17 @@
 <!--D9FFDD5DD51D434FB45628FCBAD10A4E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--D9FFDD5DD51D434FB45628FCBAD10A4E--></AD_REF_LIST>
 
+<!--DA3E593E14834F0C9895132B46C51369--><AD_REF_LIST>
+<!--DA3E593E14834F0C9895132B46C51369-->  <AD_REF_LIST_ID><![CDATA[DA3E593E14834F0C9895132B46C51369]]></AD_REF_LIST_ID>
+<!--DA3E593E14834F0C9895132B46C51369-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--DA3E593E14834F0C9895132B46C51369-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--DA3E593E14834F0C9895132B46C51369-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--DA3E593E14834F0C9895132B46C51369-->  <VALUE><![CDATA[TMP]]></VALUE>
+<!--DA3E593E14834F0C9895132B46C51369-->  <NAME><![CDATA[Temporal]]></NAME>
+<!--DA3E593E14834F0C9895132B46C51369-->  <AD_REFERENCE_ID><![CDATA[FF80818130217A350130218D802B0011]]></AD_REFERENCE_ID>
+<!--DA3E593E14834F0C9895132B46C51369-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--DA3E593E14834F0C9895132B46C51369--></AD_REF_LIST>
+
 <!--DAC02370F50D485BAA4F79957AA1A7A4--><AD_REF_LIST>
 <!--DAC02370F50D485BAA4F79957AA1A7A4-->  <AD_REF_LIST_ID><![CDATA[DAC02370F50D485BAA4F79957AA1A7A4]]></AD_REF_LIST_ID>
 <!--DAC02370F50D485BAA4F79957AA1A7A4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -12739,6 +12750,17 @@
 <!--ED26F0D8296E46BCA9A0571BEA07C66E-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--ED26F0D8296E46BCA9A0571BEA07C66E--></AD_REF_LIST>
 
+<!--EE5C654083D04EA0B1BFC90A30CF0908--><AD_REF_LIST>
+<!--EE5C654083D04EA0B1BFC90A30CF0908-->  <AD_REF_LIST_ID><![CDATA[EE5C654083D04EA0B1BFC90A30CF0908]]></AD_REF_LIST_ID>
+<!--EE5C654083D04EA0B1BFC90A30CF0908-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--EE5C654083D04EA0B1BFC90A30CF0908-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--EE5C654083D04EA0B1BFC90A30CF0908-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--EE5C654083D04EA0B1BFC90A30CF0908-->  <VALUE><![CDATA[CancelAndReplaceCreateNetShipment]]></VALUE>
+<!--EE5C654083D04EA0B1BFC90A30CF0908-->  <NAME><![CDATA[Create netting shipment on Cancel and Replace]]></NAME>
+<!--EE5C654083D04EA0B1BFC90A30CF0908-->  <AD_REFERENCE_ID><![CDATA[A26BA480E2014707B47257024C3CBFF7]]></AD_REFERENCE_ID>
+<!--EE5C654083D04EA0B1BFC90A30CF0908-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--EE5C654083D04EA0B1BFC90A30CF0908--></AD_REF_LIST>
+
 <!--EF551A190C59463988B5D970FA2F7289--><AD_REF_LIST>
 <!--EF551A190C59463988B5D970FA2F7289-->  <AD_REF_LIST_ID><![CDATA[EF551A190C59463988B5D970FA2F7289]]></AD_REF_LIST_ID>
 <!--EF551A190C59463988B5D970FA2F7289-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_TREENODE.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/AD_TREENODE.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -722,7 +722,7 @@
 <!--52118BF1A21B4D84E040007F01005FEC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--52118BF1A21B4D84E040007F01005FEC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--52118BF1A21B4D84E040007F01005FEC-->  <PARENT_ID><![CDATA[0]]></PARENT_ID>
-<!--52118BF1A21B4D84E040007F01005FEC-->  <SEQNO><![CDATA[120]]></SEQNO>
+<!--52118BF1A21B4D84E040007F01005FEC-->  <SEQNO><![CDATA[130]]></SEQNO>
 <!--52118BF1A21B4D84E040007F01005FEC--></AD_TREENODE>
 
 <!--52118BF1A21C4D84E040007F01005FEC--><AD_TREENODE>
@@ -887,7 +887,7 @@
 <!--52118BF1A22D4D84E040007F01005FEC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--52118BF1A22D4D84E040007F01005FEC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--52118BF1A22D4D84E040007F01005FEC-->  <PARENT_ID><![CDATA[0]]></PARENT_ID>
-<!--52118BF1A22D4D84E040007F01005FEC-->  <SEQNO><![CDATA[130]]></SEQNO>
+<!--52118BF1A22D4D84E040007F01005FEC-->  <SEQNO><![CDATA[140]]></SEQNO>
 <!--52118BF1A22D4D84E040007F01005FEC--></AD_TREENODE>
 
 <!--52118BF1A2324D84E040007F01005FEC--><AD_TREENODE>
@@ -1283,7 +1283,7 @@
 <!--52118BF1A2634D84E040007F01005FEC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--52118BF1A2634D84E040007F01005FEC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--52118BF1A2634D84E040007F01005FEC-->  <PARENT_ID><![CDATA[0]]></PARENT_ID>
-<!--52118BF1A2634D84E040007F01005FEC-->  <SEQNO><![CDATA[140]]></SEQNO>
+<!--52118BF1A2634D84E040007F01005FEC-->  <SEQNO><![CDATA[150]]></SEQNO>
 <!--52118BF1A2634D84E040007F01005FEC--></AD_TREENODE>
 
 <!--52118BF1A2644D84E040007F01005FEC--><AD_TREENODE>
@@ -3428,7 +3428,7 @@
 <!--52118BF1A3614D84E040007F01005FEC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--52118BF1A3614D84E040007F01005FEC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--52118BF1A3614D84E040007F01005FEC-->  <PARENT_ID><![CDATA[0]]></PARENT_ID>
-<!--52118BF1A3614D84E040007F01005FEC-->  <SEQNO><![CDATA[180]]></SEQNO>
+<!--52118BF1A3614D84E040007F01005FEC-->  <SEQNO><![CDATA[190]]></SEQNO>
 <!--52118BF1A3614D84E040007F01005FEC--></AD_TREENODE>
 
 <!--52118BF1A3624D84E040007F01005FEC--><AD_TREENODE>
@@ -3670,7 +3670,7 @@
 <!--52118BF1A3784D84E040007F01005FEC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--52118BF1A3784D84E040007F01005FEC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--52118BF1A3784D84E040007F01005FEC-->  <PARENT_ID><![CDATA[0]]></PARENT_ID>
-<!--52118BF1A3784D84E040007F01005FEC-->  <SEQNO><![CDATA[190]]></SEQNO>
+<!--52118BF1A3784D84E040007F01005FEC-->  <SEQNO><![CDATA[200]]></SEQNO>
 <!--52118BF1A3784D84E040007F01005FEC--></AD_TREENODE>
 
 <!--52118BF1A3794D84E040007F01005FEC--><AD_TREENODE>
@@ -3823,7 +3823,7 @@
 <!--52118BF1A5C94D84E040007F01005FEC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--52118BF1A5C94D84E040007F01005FEC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--52118BF1A5C94D84E040007F01005FEC-->  <PARENT_ID><![CDATA[0]]></PARENT_ID>
-<!--52118BF1A5C94D84E040007F01005FEC-->  <SEQNO><![CDATA[170]]></SEQNO>
+<!--52118BF1A5C94D84E040007F01005FEC-->  <SEQNO><![CDATA[180]]></SEQNO>
 <!--52118BF1A5C94D84E040007F01005FEC--></AD_TREENODE>
 
 <!--52118BF1A5CA4D84E040007F01005FEC--><AD_TREENODE>
@@ -3845,7 +3845,7 @@
 <!--52118BF1A5CB4D84E040007F01005FEC-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
 <!--52118BF1A5CB4D84E040007F01005FEC-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
 <!--52118BF1A5CB4D84E040007F01005FEC-->  <PARENT_ID><![CDATA[0]]></PARENT_ID>
-<!--52118BF1A5CB4D84E040007F01005FEC-->  <SEQNO><![CDATA[150]]></SEQNO>
+<!--52118BF1A5CB4D84E040007F01005FEC-->  <SEQNO><![CDATA[160]]></SEQNO>
 <!--52118BF1A5CB4D84E040007F01005FEC--></AD_TREENODE>
 
 <!--52118BF1A5CC4D84E040007F01005FEC--><AD_TREENODE>
--- a/src-db/database/sourcedata/M_OFFER_TYPE.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/M_OFFER_TYPE.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -8,6 +8,7 @@
 <!--5D4BAF6BB86D4D2C9ED3D5A6FC051579-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--5D4BAF6BB86D4D2C9ED3D5A6FC051579-->  <NAME><![CDATA[Price Adjustment]]></NAME>
 <!--5D4BAF6BB86D4D2C9ED3D5A6FC051579-->  <PL_ORDER_IMPLEMENTOR><![CDATA[M_Promotion_Adjustment]]></PL_ORDER_IMPLEMENTOR>
+<!--5D4BAF6BB86D4D2C9ED3D5A6FC051579-->  <EM_OBPOS_ISCATEGORY><![CDATA[N]]></EM_OBPOS_ISCATEGORY>
 <!--5D4BAF6BB86D4D2C9ED3D5A6FC051579--></M_OFFER_TYPE>
 
 </data>
--- a/src-db/database/sourcedata/OBUIAPP_PROCESS.xml	Thu Apr 14 18:51:24 2016 +0200
+++ b/src-db/database/sourcedata/OBUIAPP_PROCESS.xml	Fri Apr 15 13:24:44 2016 +0200
@@ -1,5 +1,23 @@
 <?xml version='1.0' encoding='UTF-8'?>
 <data>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49--><OBUIAPP_PROCESS>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <OBUIAPP_PROCESS_ID><![CDATA[0C2AFAEFB67B4CB8A1429195EB119A49]]></OBUIAPP_PROCESS_ID>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <VALUE><![CDATA[Confirmcancelandreplacesalesorder]]></VALUE>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <NAME><![CDATA[Confirm Cancel and Replace Sales Order]]></NAME>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <ACCESSLEVEL><![CDATA[3]]></ACCESSLEVEL>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <CLASSNAME><![CDATA[OB.ConfirmCancelAndReplaceSalesOrder.confirmCancelAndReplaceSalesOrder]]></CLASSNAME>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <ISBACKGROUND><![CDATA[N]]></ISBACKGROUND>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <UIPATTERN><![CDATA[M]]></UIPATTERN>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
+<!--0C2AFAEFB67B4CB8A1429195EB119A49--></OBUIAPP_PROCESS>
+
 <!--24E052E6FEB64295B64E683B5196230B--><OBUIAPP_PROCESS>
 <!--24E052E6FEB64295B64E683B5196230B-->  <OBUIAPP_PROCESS_ID><![CDATA[24E052E6FEB64295B64E683B5196230B]]></OBUIAPP_PROCESS_ID>
 <!--24E052E6FEB64295B64E683B5196230B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -415,6 +433,25 @@
 <!--A2C19D0EF6594D14A64BC62E99A89CC3-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
 <!--A2C19D0EF6594D14A64BC62E99A89CC3--></OBUIAPP_PROCESS>
 
+<!--A2FAF49712D1445ABE750315CE1B473A--><OBUIAPP_PROCESS>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <OBUIAPP_PROCESS_ID><![CDATA[A2FAF49712D1445ABE750315CE1B473A]]></OBUIAPP_PROCESS_ID>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <VALUE><![CDATA[CancelAndReplaceSalesOrder]]></VALUE>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <NAME><![CDATA[Cancel and Replace Sales Order]]></NAME>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <HELP><![CDATA[This process action will open a copy of the current row in edit mode. After changing the desired values press Confirm Candel And Replace in order to create a copy of the opened Sales Order but with negative quantities and complete it. Aftewards the process will create a new Sales Order with the new values.]]></HELP>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <ACCESSLEVEL><![CDATA[3]]></ACCESSLEVEL>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <CLASSNAME><![CDATA[OB.CancelAndReplaceSalesOrder.cancelAndReplaceSalesOrder]]></CLASSNAME>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <ISBACKGROUND><![CDATA[N]]></ISBACKGROUND>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <UIPATTERN><![CDATA[M]]></UIPATTERN>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <ISMULTIRECORD><![CDATA[N]]></ISMULTIRECORD>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <IS_EXPLICIT_ACCESS><![CDATA[N]]></IS_EXPLICIT_ACCESS>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <ISGRIDLEGACY><![CDATA[N]]></ISGRIDLEGACY>
+<!--A2FAF49712D1445ABE750315CE1B473A-->  <ISCANADDRECORDSTOSELECTOR><![CDATA[N]]></ISCANADDRECORDSTOSELECTOR>
+<!--A2FAF49712D1445ABE750315CE1B473A--></OBUIAPP_PROCESS>
+
 <!--A832A5DA28FB4BB391BDE883E928DFC5--><OBUIAPP_PROCESS>
 <!--A832A5DA28FB4BB391BDE883E928DFC5-->  <OBUIAPP_PROCESS_ID><![CDATA[A832A5DA28FB4BB391BDE883E928DFC5]]></OBUIAPP_PROCESS_ID>
 <!--A832A5DA28FB4BB391BDE883E928DFC5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/common/actionhandler/CancelAndReplaceSalesOrder.java	Fri Apr 15 13:24:44 2016 +0200
@@ -0,0 +1,151 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.common.actionhandler;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.codehaus.jettison.json.JSONArray;
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.advpaymentmngt.utility.FIN_Utility;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.core.DalUtil;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
+import org.openbravo.model.common.order.Order;
+import org.openbravo.model.common.order.OrderLine;
+import org.openbravo.service.db.DbUtility;
+
+public class CancelAndReplaceSalesOrder extends BaseActionHandler {
+  private static final Logger log = Logger.getLogger(CancelAndReplaceSalesOrder.class);
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String content) {
+
+    // Declare json to be returned
+    JSONObject result = new JSONObject();
+    JSONObject openDirectTab = new JSONObject();
+    JSONObject showMsgInProcessView = new JSONObject();
+    JSONObject showMsgInView = new JSONObject();
+    try {
+
+      // Get request parameters
+      JSONObject request = new JSONObject(content);
+      String oldOrderId = request.getString("inpcOrderId");
+      String tabId = request.getString("inpTabId");
+
+      // Get new Order
+      Order oldOrder = OBDal.getInstance().get(Order.class, oldOrderId);
+
+      // Create new Order header
+      Order newOrder = (Order) DalUtil.copy(oldOrder, false, true);
+      // Change order values
+      newOrder.setProcessed(false);
+      newOrder.setPosted("N");
+      newOrder.setDocumentStatus("TMP");
+      newOrder.setDocumentAction("CO");
+      newOrder.setGrandTotalAmount(BigDecimal.ZERO);
+      newOrder.setSummedLineAmount(BigDecimal.ZERO);
+      Date today = new Date();
+      newOrder.setOrderDate(today);
+      String newDocumentNo = FIN_Utility
+          .getDocumentNo(oldOrder.getDocumentType(), Order.TABLE_NAME);
+      newOrder.setDocumentNo(newDocumentNo);
+      newOrder.setReplacedorder(oldOrder);
+      OBDal.getInstance().save(newOrder);
+
+      // Create new Order lines
+      List<OrderLine> oldOrderLineList = oldOrder.getOrderLineList();
+      for (OrderLine oldOrderLine : oldOrderLineList) {
+        OrderLine newOrderLine = (OrderLine) DalUtil.copy(oldOrderLine, false, true);
+        newOrderLine.setDeliveredQuantity(BigDecimal.ZERO);
+        newOrderLine.setReservedQuantity(BigDecimal.ZERO);
+        newOrderLine.setInvoicedQuantity(BigDecimal.ZERO);
+        newOrderLine.setSalesOrder(newOrder);
+        newOrderLine.setReplacedorderline(oldOrderLine);
+        OBDal.getInstance().save(newOrderLine);
+      }
+
+      // Get new Order id
+      String newOrderId = newOrder.getId();
+
+      // Execute process and prepare an array with actions to be executed after execution
+      JSONArray actions = new JSONArray();
+
+      // Message in tab from where the process is executed
+      showMsgInProcessView.put("msgType", "success");
+      showMsgInProcessView.put("msgTitle", OBMessageUtils.messageBD("Success"));
+      showMsgInProcessView.put("msgText", OBMessageUtils.messageBD("OrderCreatedInTemporalStatus")
+          + " " + newDocumentNo);
+      showMsgInProcessView.put("wait", true);
+
+      JSONObject showMsgInProcessViewAction = new JSONObject();
+      showMsgInProcessViewAction.put("showMsgInProcessView", showMsgInProcessView);
+
+      actions.put(showMsgInProcessViewAction);
+
+      // New record info
+      openDirectTab.put("tabId", tabId);
+      openDirectTab.put("recordId", newOrderId);
+      openDirectTab.put("wait", true);
+
+      JSONObject openDirectTabAction = new JSONObject();
+      openDirectTabAction.put("openDirectTab", openDirectTab);
+
+      actions.put(openDirectTabAction);
+
+      // result.put("openDirectTab", openDirectTab);
+
+      // Message of the new opened tab
+      showMsgInView.put("msgType", "success");
+      showMsgInView.put("msgTitle", OBMessageUtils.messageBD("Success"));
+      showMsgInView.put("msgText", OBMessageUtils.messageBD("OrderInTemporalStatus"));
+
+      JSONObject showMsgInViewAction = new JSONObject();
+      showMsgInViewAction.put("showMsgInView", showMsgInView);
+
+      actions.put(showMsgInViewAction);
+
+      result.put("responseActions", actions);
+
+      // result.put("showMsgInView", showMsgInView);
+
+    } catch (Exception e) {
+      log.error("Error in process", e);
+      try {
+        OBDal.getInstance().getConnection().rollback();
+        result = new JSONObject();
+        JSONObject errorMessage = new JSONObject();
+        errorMessage.put("severity", "error");
+        errorMessage.put("title", OBMessageUtils.messageBD("Error"));
+        errorMessage.put("text", e.getMessage());
+        result.put("message", errorMessage);
+      } catch (Exception e2) {
+        throw new OBException(e2);
+      }
+      Throwable e3 = DbUtility.getUnderlyingSQLException(e);
+      throw new OBException(e3);
+    }
+    return result;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/common/actionhandler/ConfirmCancelAndReplaceSalesOrder.java	Fri Apr 15 13:24:44 2016 +0200
@@ -0,0 +1,62 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.common.actionhandler;
+
+import java.util.Map;
+
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.client.kernel.BaseActionHandler;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.businessUtility.CancelAndReplaceUtils;
+import org.openbravo.erpCommon.utility.OBMessageUtils;
+
+public class ConfirmCancelAndReplaceSalesOrder extends BaseActionHandler {
+
+  @Override
+  protected JSONObject execute(Map<String, Object> parameters, String content) throws OBException {
+    JSONObject result = new JSONObject();
+    try {
+
+      // Get request parameters
+      JSONObject request = new JSONObject(content);
+      String newOrderId = request.getString("inpcOrderId");
+
+      CancelAndReplaceUtils.cancelAndReplaceOrder(newOrderId, null, false);
+
+      JSONObject resultMessage = new JSONObject();
+      resultMessage.put("severity", "success");
+      resultMessage.put("title", OBMessageUtils.messageBD("Success"));
+      result.put("message", resultMessage);
+
+    } catch (Exception e1) {
+      try {
+        OBDal.getInstance().getConnection().rollback();
+        JSONObject resultMessage = new JSONObject();
+        resultMessage.put("severity", "error");
+        resultMessage.put("title", OBMessageUtils.messageBD("Error"));
+        resultMessage.put("text", OBMessageUtils.translateError(e1.getMessage()).getMessage());
+        result.put("message", resultMessage);
+      } catch (Exception e2) {
+        throw new OBException(e2);
+      }
+    }
+    return result;
+  }
+}
--- a/src/org/openbravo/common/actionhandler/SetNewBPCurrency.java	Thu Apr 14 18:51:24 2016 +0200
+++ b/src/org/openbravo/common/actionhandler/SetNewBPCurrency.java	Fri Apr 15 13:24:44 2016 +0200
@@ -167,7 +167,7 @@
             OBDal.getInstance().save(payment1);
             OBDal.getInstance().save(paymentDetail1);
             OBDal.getInstance().save(paymentScheduleDetail1);
-            FIN_PaymentProcess.doProcessPayment(payment1, "D", false, null, null);
+            FIN_PaymentProcess.doProcessPayment(payment1, "D", null, null);
 
             // Modify description of original credit payment
             String paymentCreditDesc = paymentCredit.getDescription()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/businessUtility/CancelAndReplaceUtils.java	Fri Apr 15 13:24:44 2016 +0200
@@ -0,0 +1,1048 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2015-2016 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+ */
+package org.openbravo.erpCommon.businessUtility;
+
+import java.math.BigDecimal;
+import java.sql.CallableStatement;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.codehaus.jettison.json.JSONException;
+import org.codehaus.jettison.json.JSONObject;
+import org.hibernate.Query;
+import org.hibernate.ScrollMode;
+import org.hibernate.ScrollableResults;
+import org.hibernate.criterion.Restrictions;
+import org.openbravo.advpaymentmngt.process.FIN_AddPayment;
+import org.openbravo.advpaymentmngt.process.FIN_PaymentProcess;
+import org.openbravo.advpaymentmngt.utility.FIN_Utility;
+import org.openbravo.base.exception.OBException;
+import org.openbravo.base.model.Entity;
+import org.openbravo.base.model.ModelProvider;
+import org.openbravo.base.provider.OBProvider;
+import org.openbravo.base.weld.WeldUtils;
+import org.openbravo.client.kernel.RequestContext;
+import org.openbravo.dal.core.DalUtil;
+import org.openbravo.dal.core.OBContext;
+import org.openbravo.dal.core.TriggerHandler;
+import org.openbravo.dal.security.OrganizationStructureProvider;
+import org.openbravo.dal.service.OBCriteria;
+import org.openbravo.dal.service.OBDal;
+import org.openbravo.erpCommon.ad_forms.AcctServer;
+import org.openbravo.erpCommon.utility.PropertyException;
+import org.openbravo.erpCommon.utility.Utility;
+import org.openbravo.materialmgmt.ReservationUtils;
+import org.openbravo.model.ad.access.OrderLineTax;
+import org.openbravo.model.ad.datamodel.Table;
+import org.openbravo.model.common.enterprise.DocumentType;
+import org.openbravo.model.common.enterprise.Locator;
+import org.openbravo.model.common.order.Order;
+import org.openbravo.model.common.order.OrderLine;
+import org.openbravo.model.common.order.OrderTax;
+import org.openbravo.model.financialmgmt.payment.FIN_FinaccTransaction;
+import org.openbravo.model.financialmgmt.payment.FIN_FinancialAccount;
+import org.openbravo.model.financialmgmt.payment.FIN_Payment;
+import org.openbravo.model.financialmgmt.payment.FIN_PaymentDetail;
+import org.openbravo.model.financialmgmt.payment.FIN_PaymentMethod;
+import org.openbravo.model.financialmgmt.payment.FIN_PaymentSchedule;
+import org.openbravo.model.financialmgmt.payment.FIN_PaymentScheduleDetail;
+import org.openbravo.model.materialmgmt.onhandquantity.Reservation;
+import org.openbravo.model.materialmgmt.onhandquantity.ReservationStock;
+import org.openbravo.model.materialmgmt.transaction.MaterialTransaction;
+import org.openbravo.model.materialmgmt.transaction.ShipmentInOut;
+import org.openbravo.model.materialmgmt.transaction.ShipmentInOutLine;
+import org.openbravo.retail.posterminal.OBPOSAppCashup;
+import org.openbravo.service.db.CallStoredProcedure;
+import org.openbravo.service.db.DalConnectionProvider;
+import org.openbravo.service.db.DbUtility;
+
+public class CancelAndReplaceUtils {
+  private static Logger log4j = Logger.getLogger(CancelAndReplaceUtils.class);
+  private static Date today = null;
+  private static final BigDecimal NEGATIVE_ONE = new BigDecimal(-1);
+  private static final String CREATE_NETTING_SHIPMENT = "CancelAndReplaceCreateNetShipment";
+  private static OrganizationStructureProvider osp = null;
+
+  public static void cancelOrder(String newOrderId, JSONObject jsonorder,
+      boolean useOrderDocumentNoForRelatedDocs) {
+    cancelAndReplaceOrder(newOrderId, jsonorder, useOrderDocumentNoForRelatedDocs, false);
+  }
+
+  public static void cancelAndReplaceOrder(String newOrderId, JSONObject jsonorder,
+      boolean useOrderDocumentNoForRelatedDocs) {
+    cancelAndReplaceOrder(newOrderId, jsonorder, useOrderDocumentNoForRelatedDocs, true);
+  }
+
+  /**
+   * Process that cancels an existing order and creates another one inverse of the original. If it
+   * is indicated a new order is created with received modifications that replaces the original one.
+   * 
+   * This process will create a netting goods shipment to leave the original order and the inverse
+   * order completely delivered, and if anything is delivered was delivered in the original order it
+   * will be delivered so in the new one.
+   * 
+   * The same behavior of shipments will be implemented with payments.
+   * 
+   * @param orderId
+   *          Order Id of the new order or of the old order, depending on replaceOrder boolean.
+   * @param jsonorder
+   *          JSON Object of the order coming from Web POS
+   * @param useOrderDocumentNoForRelatedDocs
+   *          OBPOS_UseOrderDocumentNoForRelatedDocs preference from Web POS.
+   * @param replaceOrder
+   *          If replaceOrder == true, the original order will be cancelled and replaced with a new
+   *          one, if == false, it will only be cancelled
+   * @return
+   */
+  protected static void cancelAndReplaceOrder(String orderId, JSONObject jsonorder,
+      boolean useOrderDocumentNoForRelatedDocs, boolean replaceOrder) {
+    ScrollableResults orderLines = null;
+    try {
+
+      boolean triggersDisabled = false;
+      if (jsonorder != null && replaceOrder) {
+        triggersDisabled = true;
+      }
+
+      Order newOrder = null;
+      Order oldOrder = null;
+
+      // If replaceOrder == true, the original order will be cancelled and replaced with a new one,
+      // if == false, it will only be cancelled
+      if (replaceOrder) {
+        // Get new Order
+        newOrder = OBDal.getInstance().get(Order.class, orderId);
+        // Get old Order
+        oldOrder = newOrder.getReplacedorder();
+      } else {
+        // Get old Order
+        oldOrder = OBDal.getInstance().get(Order.class, orderId);
+      }
+
+      // Added check in case Cancel and Replace button is hit more than once
+      if (jsonorder == null && oldOrder.isCancelled()) {
+        throw new OBException("@APRM_Order@ " + oldOrder.getDocumentNo() + " @IsCancelled@");
+      }
+
+      today = new Date();
+
+      osp = OBContext.getOBContext().getOrganizationStructureProvider(
+          oldOrder.getOrganization().getClient().getId());
+
+      // Release old reservations
+      if (!triggersDisabled) {
+        releaseOldReservations(oldOrder);
+      }
+
+      // Get documentNo for the inverse Order Header coming from jsonorder, if exists
+      JSONObject negativeDocumentNoJSON = jsonorder != null && jsonorder.has("negativeDocNo") ? jsonorder
+          .getJSONObject("negativeDocNo") : null;
+      String negativeDocNo = negativeDocumentNoJSON != null
+          && negativeDocumentNoJSON.has("documentNo")
+          && negativeDocumentNoJSON.get("documentNo") != JSONObject.NULL ? negativeDocumentNoJSON
+          .getString("documentNo") : null;
+
+      // Create inverse Order header
+      Order inverseOrder = createOrder(oldOrder, jsonorder, negativeDocNo, triggersDisabled);
+
+      // Define netting goods shipment and its lines
+      ShipmentInOut nettingGoodsShipment = null;
+      ShipmentInOutLine newGoodsShipmentLine1 = null;
+
+      // Iterate old order lines
+      orderLines = getOrderLineList(oldOrder);
+      long lineNoCounter = 1;
+      while (orderLines.next()) {
+        OrderLine oldOrderLine = (OrderLine) orderLines.get(0);
+
+        // Create inverse Order line
+        OrderLine inverseOrderLine = createOrderLine(oldOrderLine, inverseOrder, replaceOrder,
+            triggersDisabled);
+
+        // Get Shipment lines of old order line
+        OBCriteria<ShipmentInOutLine> goodsShipmentLineCriteria = OBDal.getInstance()
+            .createCriteria(ShipmentInOutLine.class);
+        goodsShipmentLineCriteria.add(Restrictions.eq(ShipmentInOutLine.PROPERTY_SALESORDERLINE,
+            oldOrderLine));
+        goodsShipmentLineCriteria.addOrderBy(ShipmentInOutLine.PROPERTY_UPDATED, true);
+        List<ShipmentInOutLine> goodsShipmentLineList = goodsShipmentLineCriteria.list();
+
+        // check "Don't create netting shipment in Cancel and Replace" preference value
+        boolean createNettingGoodsShipment = false;
+        try {
+          createNettingGoodsShipment = ("Y").equals(Preferences.getPreferenceValue(
+              CancelAndReplaceUtils.CREATE_NETTING_SHIPMENT, true, oldOrder.getClient(),
+              oldOrder.getOrganization(), OBContext.getOBContext().getUser(), null, null));
+        } catch (PropertyException e1) {
+          createNettingGoodsShipment = false;
+        }
+
+        if (createNettingGoodsShipment && inverseOrderLine != null) {
+          // Create Netting goods shipment Header
+          if (nettingGoodsShipment == null) {
+            nettingGoodsShipment = createShipment(oldOrder, goodsShipmentLineList);
+          }
+
+          // Stock manipulation
+          org.openbravo.database.ConnectionProvider cp = new DalConnectionProvider(false);
+          CallableStatement updateStockStatement = cp.getConnection().prepareCall(
+              "{call M_UPDATE_INVENTORY (?,?,?,?,?,?,?,?,?,?,?,?,?)}");
+
+          // Create Netting goods shipment Line for the old order line
+          BigDecimal movementQty = oldOrderLine.getOrderedQuantity().subtract(
+              oldOrderLine.getDeliveredQuantity());
+          BigDecimal oldOrderLineDeliveredQty = oldOrderLine.getDeliveredQuantity();
+          oldOrderLine.setDeliveredQuantity(BigDecimal.ZERO);
+          OBDal.getInstance().save(oldOrderLine);
+          OBDal.getInstance().flush();
+          if (movementQty.compareTo(BigDecimal.ZERO) != 0) {
+            newGoodsShipmentLine1 = createShipmentLine(nettingGoodsShipment,
+                goodsShipmentLineList.size() > 0 ? goodsShipmentLineList.get(0) : null,
+                oldOrderLine, lineNoCounter++, movementQty, updateStockStatement, triggersDisabled);
+          }
+          // Create Netting goods shipment Line for the inverse order line
+          movementQty = inverseOrderLine.getOrderedQuantity().subtract(
+              inverseOrderLine.getDeliveredQuantity());
+          if (movementQty.compareTo(BigDecimal.ZERO) != 0) {
+            createShipmentLine(nettingGoodsShipment, newGoodsShipmentLine1, inverseOrderLine,
+                lineNoCounter++, movementQty, updateStockStatement, triggersDisabled);
+          }
+
+          if (replaceOrder) {
+            // Get the the new order line that replaces the old order line, should be only one
+            OBCriteria<OrderLine> olc = OBDal.getInstance().createCriteria(OrderLine.class);
+            olc.add(Restrictions.eq(OrderLine.PROPERTY_REPLACEDORDERLINE, oldOrderLine));
+            olc.add(Restrictions.eq(OrderLine.PROPERTY_SALESORDER, newOrder));
+            olc.setMaxResults(1);
+            OrderLine newOrderLine = (OrderLine) olc.uniqueResult();
+            if (newOrderLine != null) {
+              // Create Netting goods shipment Line for the new order line
+              movementQty = oldOrderLineDeliveredQty;
+              BigDecimal newOrderLineDeliveredQty = newOrderLine.getDeliveredQuantity();
+              newOrderLine.setDeliveredQuantity(BigDecimal.ZERO);
+              OBDal.getInstance().save(newOrderLine);
+              OBDal.getInstance().flush();
+              if (movementQty.compareTo(BigDecimal.ZERO) != 0) {
+                createShipmentLine(nettingGoodsShipment, newGoodsShipmentLine1, newOrderLine,
+                    lineNoCounter++, movementQty, updateStockStatement, triggersDisabled);
+              }
+              if (newOrderLineDeliveredQty == null
+                  || newOrderLineDeliveredQty.compareTo(BigDecimal.ZERO) == 0) {
+                // Set new order line delivered quantity to old order line ordered quantity, this
+                // case
+                // coming from Backend (nothing is delivered)
+                newOrderLine.setDeliveredQuantity(movementQty);
+              } else {
+                // Set new order line delivered quantity to previous delivery quantity, this case
+                // coming from Web POS (everything is delivered)
+                newOrderLine.setDeliveredQuantity(newOrderLineDeliveredQty);
+              }
+              OBDal.getInstance().save(newOrderLine);
+            }
+          }
+        }
+
+        // Set old order delivered quantity to the ordered quantity
+        oldOrderLine.setDeliveredQuantity(oldOrderLine.getOrderedQuantity());
+        OBDal.getInstance().save(oldOrderLine);
+
+        // Set inverse order delivered quantity to ordered quantity
+        if (inverseOrderLine != null) {
+          inverseOrderLine.setDeliveredQuantity(inverseOrderLine.getOrderedQuantity());
+          OBDal.getInstance().save(inverseOrderLine);
+        }
+      }
+      if (nettingGoodsShipment != null) {
+        processShipment(nettingGoodsShipment);
+      }
+
+      // Close inverse order
+      inverseOrder.setDocumentStatus("CL");
+      inverseOrder.setDocumentAction("--");
+      inverseOrder.setProcessed(true);
+      inverseOrder.setProcessNow(false);
+      OBDal.getInstance().save(inverseOrder);
+
+      // Close original order
+      oldOrder.setDocumentStatus("CL");
+      oldOrder.setDocumentAction("--");
+      oldOrder.setCancelled(true);
+      oldOrder.setProcessed(true);
+      oldOrder.setProcessNow(false);
+      OBDal.getInstance().save(oldOrder);
+
+      // Set Stardard Order to new order document type
+
+      // Complete new order and generate good shipment and sales invoice
+      if (!triggersDisabled && replaceOrder) {
+        newOrder.setDocumentStatus("DR");
+        OBDal.getInstance().save(newOrder);
+        callCOrderPost(newOrder);
+
+        // Create new reservations
+        createNewReservations(newOrder);
+
+        OBDal.getInstance().flush();
+      }
+
+      // Payment Creation
+      // Get the payment schedule detail of the oldOrder
+      createPayments(oldOrder, newOrder, inverseOrder, jsonorder, useOrderDocumentNoForRelatedDocs,
+          replaceOrder, triggersDisabled);
+
+    } catch (Exception e1) {
+      try {
+        OBDal.getInstance().getConnection().rollback();
+      } catch (Exception e2) {
+        throw new OBException(e2);
+      }
+      Throwable e3 = DbUtility.getUnderlyingSQLException(e1);
+      throw new OBException(e3.getMessage());
+    } finally {
+      if (orderLines != null) {
+        orderLines.close();
+      }
+    }
+  }
+
+  protected static void callCOrderPost(Order order) throws OBException {
+    final List<Object> parameters = new ArrayList<Object>();
+    parameters.add(null);
+    parameters.add(order.getId());
+    final String procedureName = "c_order_post1";
+    CallStoredProcedure.getInstance().call(procedureName, parameters, null, true, false);
+  }
+
+  private static Order createOrder(Order oldOrder, JSONObject jsonorder, String documentNo,
+      boolean triggersDisabled) throws JSONException {
+    Order inverseOrder = (Order) DalUtil.copy(oldOrder, false, true);
+    // Change order values
+    inverseOrder.setPosted("N");
+    inverseOrder.setProcessed(false);
+    inverseOrder.setDocumentStatus("DR");
+    inverseOrder.setDocumentAction("CO");
+    if (triggersDisabled) {
+      inverseOrder.setGrandTotalAmount(oldOrder.getGrandTotalAmount().negate());
+      inverseOrder.setSummedLineAmount(oldOrder.getSummedLineAmount().negate());
+    } else {
+      inverseOrder.setGrandTotalAmount(BigDecimal.ZERO);
+      inverseOrder.setSummedLineAmount(BigDecimal.ZERO);
+    }
+    inverseOrder.setOrderDate(today);
+    inverseOrder.setCreationDate(today);
+    inverseOrder.setUpdated(today);
+    inverseOrder.setScheduledDeliveryDate(today);
+    String newDocumentNo = documentNo;
+    if (newDocumentNo == null) {
+      newDocumentNo = FIN_Utility.getDocumentNo(oldOrder.getDocumentType(), Order.TABLE_NAME);
+    }
+    inverseOrder.setDocumentNo(newDocumentNo);
+    inverseOrder.setCancelledorder(oldOrder);
+    inverseOrder.setObposAppCashup(jsonorder.getString("obposAppCashup"));
+    OBDal.getInstance().save(inverseOrder);
+
+    // Copy old order taxes to inverse, it is done when is executed from Web POS because triggers
+    // are disabled
+    if (triggersDisabled) {
+      createOrderTaxes(oldOrder, inverseOrder);
+    }
+
+    return inverseOrder;
+  }
+
+  protected static void createOrderTaxes(Order oldOrder, Order inverseOrder) {
+    for (OrderTax orderTax : oldOrder.getOrderTaxList()) {
+      OrderTax inverseOrderTax = (OrderTax) DalUtil.copy(orderTax, false, true);
+      BigDecimal inverseTaxAmount = orderTax.getTaxAmount().negate();
+      BigDecimal inverseTaxableAmount = orderTax.getTaxableAmount().negate();
+      inverseOrderTax.setTaxAmount(inverseTaxAmount);
+      inverseOrderTax.setTaxableAmount(inverseTaxableAmount);
+      inverseOrderTax.setSalesOrder(inverseOrder);
+      inverseOrder.getOrderTaxList().add(inverseOrderTax);
+      OBDal.getInstance().save(inverseOrderTax);
+    }
+    OBDal.getInstance().flush();
+  }
+
+  protected static OrderLine createOrderLine(OrderLine oldOrderLine, Order inverseOrder,
+      boolean replaceOrder, boolean triggersDisabled) {
+    if (!replaceOrder
+        && oldOrderLine.getDeliveredQuantity().compareTo(oldOrderLine.getOrderedQuantity()) == 0) {
+      return null;
+    }
+    OrderLine inverseOrderLine = (OrderLine) DalUtil.copy(oldOrderLine, false, true);
+    inverseOrderLine.setSalesOrder(inverseOrder);
+    if (!replaceOrder && oldOrderLine.getDeliveredQuantity().compareTo(BigDecimal.ZERO) == 1) {
+      BigDecimal inverseOrderedQuantity = oldOrderLine.getOrderedQuantity()
+          .subtract(oldOrderLine.getDeliveredQuantity()).negate();
+      inverseOrderLine.setOrderedQuantity(inverseOrderedQuantity);
+    } else {
+      inverseOrderLine.setOrderedQuantity(inverseOrderLine.getOrderedQuantity().negate());
+    }
+    if (triggersDisabled) {
+      inverseOrderLine.setLineGrossAmount(oldOrderLine.getLineGrossAmount().negate());
+      inverseOrderLine.setLineNetAmount(oldOrderLine.getLineNetAmount().negate());
+    }
+    // Set inverse order delivered quantity zero
+    inverseOrderLine.setDeliveredQuantity(BigDecimal.ZERO);
+    inverseOrderLine.setReservedQuantity(BigDecimal.ZERO);
+
+    inverseOrder.getOrderLineList().add(inverseOrderLine);
+    OBDal.getInstance().save(inverseOrderLine);
+
+    // Copy old order taxes to inverse, it is done when is executed from Web POS because triggers
+    // are disabled
+    if (triggersDisabled) {
+      createOrderLineTaxes(oldOrderLine, inverseOrderLine, inverseOrder);
+    }
+
+    return inverseOrderLine;
+  }
+
+  protected static void createOrderLineTaxes(OrderLine oldOrderLine, OrderLine inverseOrderLine,
+      Order inverseOrder) {
+    for (OrderLineTax orderLineTax : oldOrderLine.getOrderLineTaxList()) {
+      final OrderLineTax inverseOrderLineTax = (OrderLineTax) DalUtil.copy(orderLineTax, false,
+          true);
+      BigDecimal inverseTaxAmount = orderLineTax.getTaxAmount().negate();
+      BigDecimal inverseTaxableAmount = orderLineTax.getTaxableAmount().negate();
+      inverseOrderLineTax.setTaxAmount(inverseTaxAmount);
+      inverseOrderLineTax.setTaxableAmount(inverseTaxableAmount);
+      inverseOrderLineTax.setSalesOrder(inverseOrder);
+      inverseOrderLineTax.setSalesOrderLine(inverseOrderLine);
+      inverseOrderLine.getOrderLineTaxList().add(inverseOrderLineTax);
+      inverseOrder.getOrderLineTaxList().add(inverseOrderLineTax);
+      OBDal.getInstance().save(inverseOrderLineTax);
+    }
+    OBDal.getInstance().flush();
+  }
+
+  protected static ShipmentInOut createShipment(Order oldOrder,
+      List<ShipmentInOutLine> goodsShipmentLineList) {
+    ShipmentInOut nettingGoodsShipment = null;
+    // if (goodsShipmentLineList != null && goodsShipmentLineList.size() == 0) {
+    if (goodsShipmentLineList.size() == 0) {
+      // Create new Shipment
+      nettingGoodsShipment = OBProvider.getInstance().get(ShipmentInOut.class);
+      nettingGoodsShipment.setOrganization(oldOrder.getOrganization());
+      // Set Document Type
+      OBCriteria<DocumentType> goodsShipmentDocumentTypeCriteria = OBDal.getInstance()
+          .createCriteria(DocumentType.class);
+      OBCriteria<Table> goodsShipmentTableCriteria = OBDal.getInstance()
+          .createCriteria(Table.class);
+      goodsShipmentTableCriteria.add(Restrictions.eq(Table.PROPERTY_DBTABLENAME,
+          ShipmentInOut.TABLE_NAME));
+      List<Table> goodsShipmentTableList = goodsShipmentTableCriteria.list();
+      if (goodsShipmentTableList.size() != 1) {
+        throw new OBException("Only one table named M_InOut can exists");
+      }
+      Table goodsShipmentTable = goodsShipmentTableList.get(0);
+      goodsShipmentDocumentTypeCriteria.add(Restrictions.eq(DocumentType.PROPERTY_TABLE,
+          goodsShipmentTable));
+      goodsShipmentDocumentTypeCriteria.add(Restrictions.eq(DocumentType.PROPERTY_SALESTRANSACTION,
+          true));
+      List<String> parentOrganizationIdList = osp.getParentList(oldOrder.getOrganization().getId(),
+          true);
+      goodsShipmentDocumentTypeCriteria.add(Restrictions.in(DocumentType.PROPERTY_ORGANIZATION
+          + ".id", parentOrganizationIdList));
+      goodsShipmentDocumentTypeCriteria.add(Restrictions.eq(DocumentType.PROPERTY_ACTIVE, true));
+      goodsShipmentDocumentTypeCriteria.addOrderBy(DocumentType.PROPERTY_DEFAULT, false);
+      List<DocumentType> goodsShipmentDocumentTypeList = goodsShipmentDocumentTypeCriteria.list();
+      if (goodsShipmentDocumentTypeList.size() == 0) {
+        throw new OBException("No document type found for the new shipment");
+      }
+      DocumentType goodsShipmentDocumentType = goodsShipmentDocumentTypeList.get(0);
+      nettingGoodsShipment.setDocumentType(goodsShipmentDocumentType);
+      nettingGoodsShipment.setWarehouse(oldOrder.getWarehouse());
+      nettingGoodsShipment.setBusinessPartner(oldOrder.getBusinessPartner());
+      if (oldOrder.getPartnerAddress() == null) {
+        throw new OBException("The business partner location can not be null");
+      }
+      nettingGoodsShipment.setPartnerAddress(oldOrder.getPartnerAddress());
+    } else {
+      nettingGoodsShipment = (ShipmentInOut) DalUtil.copy(goodsShipmentLineList.get(0)
+          .getShipmentReceipt(), false, true);
+    }
+    nettingGoodsShipment.setMovementDate(today);
+    nettingGoodsShipment.setAccountingDate(today);
+    nettingGoodsShipment.setSalesOrder(null);
+    nettingGoodsShipment.setPosted("N");
+    nettingGoodsShipment.setProcessed(false);
+    nettingGoodsShipment.setDocumentStatus("DR");
+    nettingGoodsShipment.setDocumentAction("CO");
+    nettingGoodsShipment.setMovementType("C-");
+    nettingGoodsShipment.setProcessGoodsJava("--");
+    String nettingGoodsShipmentDocumentNo = FIN_Utility.getDocumentNo(
+        nettingGoodsShipment.getDocumentType(), ShipmentInOut.TABLE_NAME);
+    nettingGoodsShipment.setDocumentNo(nettingGoodsShipmentDocumentNo);
+    OBDal.getInstance().save(nettingGoodsShipment);
+    return nettingGoodsShipment;
+  }
+
+  protected static ShipmentInOutLine createShipmentLine(ShipmentInOut nettingGoodsShipment,
+      ShipmentInOutLine nettingGoodsShipmentLine, OrderLine orderLine, long lineNoCounter,
+      BigDecimal movementQty, CallableStatement updateStockStatement, boolean triggersDisabled) {
+    ShipmentInOutLine newGoodsShipmentLine = null;
+    if (nettingGoodsShipmentLine == null) {
+      newGoodsShipmentLine = OBProvider.getInstance().get(ShipmentInOutLine.class);
+      newGoodsShipmentLine.setOrganization(orderLine.getOrganization());
+      newGoodsShipmentLine.setProduct(orderLine.getProduct());
+      newGoodsShipmentLine.setUOM(orderLine.getUOM());
+      // Get first storage bin
+      Locator locator1 = nettingGoodsShipment.getWarehouse().getLocatorList().get(0);
+      newGoodsShipmentLine.setStorageBin(locator1);
+    } else {
+      newGoodsShipmentLine = (ShipmentInOutLine) DalUtil
+          .copy(nettingGoodsShipmentLine, false, true);
+    }
+    newGoodsShipmentLine.setLineNo(10 * lineNoCounter);
+    newGoodsShipmentLine.setSalesOrderLine(orderLine);
+    newGoodsShipmentLine.setShipmentReceipt(nettingGoodsShipment);
+    newGoodsShipmentLine.setMovementQuantity(movementQty);
+
+    // Create Material Transaction record
+    createMTransaction(newGoodsShipmentLine, updateStockStatement, triggersDisabled);
+
+    OBDal.getInstance().save(newGoodsShipmentLine);
+    return newGoodsShipmentLine;
+  }
+
+  protected static void releaseOldReservations(Order oldOrder) {
+    ScrollableResults oldOrderLines = null;
+    try {
+      // Iterate old order lines
+      oldOrderLines = getOrderLineList(oldOrder);
+      while (oldOrderLines.next()) {
+        OrderLine oldOrderLine = (OrderLine) oldOrderLines.get(0);
+        OBCriteria<Reservation> reservationCriteria = OBDal.getInstance().createCriteria(
+            Reservation.class);
+        reservationCriteria.add(Restrictions.eq(Reservation.PROPERTY_SALESORDERLINE, oldOrderLine));
+        reservationCriteria.setMaxResults(1);
+        Reservation reservation = (Reservation) reservationCriteria.uniqueResult();
+        if (reservation != null) {
+          releaseReservation(reservation);
+          OBDal.getInstance().save(reservation);
+        }
+      }
+    } catch (Exception e) {
+      log4j.error("Error in CancelAndReplaceUtils.releaseOldReservations", e);
+      throw new OBException(e.getMessage(), e);
+    } finally {
+      if (oldOrderLines != null) {
+        oldOrderLines.close();
+      }
+    }
+  }
+
+  // Release a reservation
+  protected static void releaseReservation(Reservation reservation) {
+    final StringBuilder hqlReservations = new StringBuilder();
+    hqlReservations.append(" update " + ReservationStock.ENTITY_NAME + " as rs set rs."
+        + ReservationStock.PROPERTY_RELEASED + " = rs." + ReservationStock.PROPERTY_QUANTITY);
+    hqlReservations.append(" where rs." + ReservationStock.PROPERTY_RESERVATION + "."
+        + Reservation.PROPERTY_ID + " = :reservationId");
+    Query updateTransactions = OBDal.getInstance().getSession()
+        .createQuery(hqlReservations.toString());
+    updateTransactions.setParameter("reservationId", reservation.getId());
+    updateTransactions.executeUpdate();
+
+    OBDal.getInstance().flush();
+  }
+
+  protected static void createNewReservations(Order newOrder) {
+    ScrollableResults newOrderLines = null;
+    try {
+      // Iterate old order lines
+      newOrderLines = getOrderLineList(newOrder);
+      while (newOrderLines.next()) {
+        OrderLine newOrderLine = (OrderLine) newOrderLines.get(0);
+        OBCriteria<Reservation> reservationCriteria = OBDal.getInstance().createCriteria(
+            Reservation.class);
+        reservationCriteria.add(Restrictions.eq(Reservation.PROPERTY_SALESORDERLINE,
+            newOrderLine.getReplacedorderline()));
+        reservationCriteria.setMaxResults(1);
+        Reservation reservation = (Reservation) reservationCriteria.uniqueResult();
+        if (reservation != null) {
+          ReservationUtils.createReserveFromSalesOrderLine(newOrderLine, true);
+        }
+      }
+    } catch (Exception e) {
+      log4j.error("Error in CancelAndReplaceUtils.createNewReservations", e);
+      throw new OBException(e.getMessage(), e);
+    } finally {
+      if (newOrderLines != null) {
+        newOrderLines.close();
+      }
+    }
+  }
+
+  protected static ScrollableResults getOrderLineList(Order order) {
+    OBCriteria<OrderLine> orderLinesCriteria = OBDal.getInstance().createCriteria(OrderLine.class);
+    orderLinesCriteria.add(Restrictions.eq(OrderLine.PROPERTY_SALESORDER, order));
+
+    ScrollableResults orderLines = orderLinesCriteria.scroll(ScrollMode.FORWARD_ONLY);
+    return orderLines;
+  }
+
+  protected static void createMTransaction(ShipmentInOutLine line,
+      CallableStatement updateStockStatement, boolean triggersDisabled) {
+    if (line.getProduct().getProductType().equals("I") && line.getProduct().isStocked()) {
+      // Stock is changed only for stocked products of type "Item"
+      MaterialTransaction transaction = OBProvider.getInstance().get(MaterialTransaction.class);
+      transaction.setOrganization(line.getOrganization());
+      transaction.setMovementType(line.getShipmentReceipt().getMovementType());
+      transaction.setProduct(line.getProduct());
+      transaction.setStorageBin(line.getStorageBin());
+      transaction.setOrderUOM(line.getOrderUOM());
+      transaction.setUOM(line.getUOM());
+      transaction.setOrderQuantity(line.getOrderQuantity());
+      transaction.setMovementQuantity(line.getMovementQuantity().multiply(NEGATIVE_ONE));
+      transaction.setMovementDate(line.getShipmentReceipt().getMovementDate());
+      transaction.setGoodsShipmentLine(line);
+      transaction.setAttributeSetValue(line.getAttributeSetValue());
+
+      // Execute M_UPDATE_INVENTORY stored procedure, it is done when is executed from Web POS
+      // because triggers are disabled
+      if (triggersDisabled) {
+        updateInventory(transaction, updateStockStatement);
+      }
+
+      OBDal.getInstance().save(transaction);
+    }
+  }
+
+  protected static void updateInventory(MaterialTransaction transaction,
+      CallableStatement updateStockStatement) {
+    try {
+      // client
+      updateStockStatement.setString(1, OBContext.getOBContext().getCurrentClient().getId());
+      // org
+      updateStockStatement.setString(2, OBContext.getOBContext().getCurrentOrganization().getId());
+      // user
+      updateStockStatement.setString(3, OBContext.getOBContext().getUser().getId());
+      // product
+      updateStockStatement.setString(4, transaction.getProduct().getId());
+      // locator
+      updateStockStatement.setString(5, transaction.getStorageBin().getId());
+      // attributesetinstance
+      updateStockStatement.setString(6, transaction.getAttributeSetValue() != null ? transaction
+          .getAttributeSetValue().getId() : null);
+      // uom
+      updateStockStatement.setString(7, transaction.getUOM().getId());
+      // product uom
+      updateStockStatement.setString(8, null);
+      // p_qty
+      updateStockStatement.setBigDecimal(9,
+          transaction.getMovementQuantity() != null ? transaction.getMovementQuantity() : null);
+      // p_qtyorder
+      updateStockStatement.setBigDecimal(10,
+          transaction.getOrderQuantity() != null ? transaction.getOrderQuantity() : null);
+      // p_dateLastInventory --- **
+      updateStockStatement.setDate(11, null);
+      // p_preqty
+      updateStockStatement.setBigDecimal(12, BigDecimal.ZERO);
+      // p_preqtyorder
+      updateStockStatement.setBigDecimal(13, transaction.getOrderQuantity() != null ? transaction
+          .getOrderQuantity().multiply(NEGATIVE_ONE) : null);
+
+      updateStockStatement.execute();
+
+    } catch (Exception e) {
+      log4j.error("Error in CancelAndReplaceUtils.updateInventory", e);
+      throw new OBException(e.getMessage(), e);
+    }
+  }
+
+  protected static void processShipment(ShipmentInOut shipment) {
+    if (shipment.isProcessed()) {
+      shipment.setPosted("N");
+      shipment.setProcessed(false);
+      shipment.setDocumentStatus("DR");
+      shipment.setDocumentAction("CO");
+    } else {
+      shipment.setPosted("Y");
+      shipment.setProcessed(true);
+      shipment.setDocumentStatus("CO");
+      shipment.setDocumentAction("--");
+    }
+    OBDal.getInstance().save(shipment);
+    OBDal.getInstance().flush();
+  }
+
+  protected static void createPayments(Order oldOrder, Order newOrder, Order inverseOrder,
+      JSONObject jsonorder, boolean useOrderDocumentNoForRelatedDocs, boolean replaceOrder,
+      boolean triggersDisabled) {
+    try {
+      FIN_PaymentSchedule paymentSchedule;
+      OBCriteria<FIN_PaymentSchedule> paymentScheduleCriteria = OBDal.getInstance().createCriteria(
+          FIN_PaymentSchedule.class);
+      paymentScheduleCriteria.add(Restrictions.eq(FIN_PaymentSchedule.PROPERTY_ORDER, oldOrder));
+      List<FIN_PaymentSchedule> paymentScheduleList = paymentScheduleCriteria.list();
+      boolean inversePaymentCreated = false;
+      if (paymentScheduleList.size() != 0) {
+        paymentSchedule = paymentScheduleList.get(0);
+        FIN_Payment newPayment = null;
+        if (replaceOrder) {
+          // Get the payment schedule detail of the order
+          OBCriteria<FIN_PaymentScheduleDetail> paymentScheduleDetailCriteria = OBDal.getInstance()
+              .createCriteria(FIN_PaymentScheduleDetail.class);
+          paymentScheduleDetailCriteria.add(Restrictions.eq(
+              FIN_PaymentScheduleDetail.PROPERTY_ORDERPAYMENTSCHEDULE, paymentSchedule));
+          // We are looking for the ones with a payment detail
+          paymentScheduleDetailCriteria.add(Restrictions
+              .isNotNull(FIN_PaymentScheduleDetail.PROPERTY_PAYMENTDETAILS));
+          List<FIN_PaymentScheduleDetail> paymentScheduleDetailList = paymentScheduleDetailCriteria
+              .list();
+          // New payment definition
+          for (FIN_PaymentScheduleDetail paymentScheduleDetail : paymentScheduleDetailList) {
+            newPayment = null;
+            String paymentDocumentNo = null;
+
+            FIN_PaymentDetail paymentDetail = paymentScheduleDetail.getPaymentDetails();
+            FIN_Payment payment = paymentDetail.getFinPayment();
+            FIN_PaymentMethod paymentPaymentMethod = payment.getPaymentMethod();
+            BigDecimal amount = payment.getAmount();
+            BigDecimal negativeAmount = paymentSchedule.getAmount().negate();
+            DocumentType paymentDocumentType = payment.getDocumentType();
+            FIN_FinancialAccount financialAccount = payment.getAccount();
+            BigDecimal paymentTotalAmount = BigDecimal.ZERO;
+
+            paymentDocumentNo = getPaymentDocumentNo(useOrderDocumentNoForRelatedDocs, oldOrder,
+                paymentDocumentType);
+
+            // Get Payment Description
+            String description = getPaymentDescription();
+            description += ": " + inverseOrder.getDocumentNo();
+
+            if (!triggersDisabled) {
+              // Only for BackEnd WorkFlow
+              // Get the payment schedule of the new order to check the outstanding amount, could
+              // have been automatically paid on C_ORDER_POST if is automatically invoiced and the
+              // payment method of the financial account is configured as 'Automatic Receipt'
+              FIN_PaymentSchedule paymentScheduleNewOrder = null;
+              OBCriteria<FIN_PaymentSchedule> paymentScheduleCriteriaNewOrder = OBDal.getInstance()
+                  .createCriteria(FIN_PaymentSchedule.class);
+              paymentScheduleCriteriaNewOrder.add(Restrictions.eq(
+                  FIN_PaymentSchedule.PROPERTY_ORDER, newOrder));
+              paymentScheduleCriteriaNewOrder.setMaxResults(1);
+              paymentScheduleNewOrder = (FIN_PaymentSchedule) paymentScheduleCriteriaNewOrder
+                  .uniqueResult();
+              amount = paymentScheduleNewOrder.getOutstandingAmount();
+            }
+            if (amount.compareTo(BigDecimal.ZERO) != 0) {
+              // Duplicate payment with positive amount
+              newPayment = createPayment(newPayment, newOrder, paymentPaymentMethod, amount,
+                  paymentDocumentType, financialAccount, paymentDocumentNo);
+              description += ": " + newOrder.getDocumentNo();
+              paymentTotalAmount = paymentTotalAmount.add(amount);
+            }
+
+            if (negativeAmount.compareTo(BigDecimal.ZERO) != 0 && !inversePaymentCreated) {
+              // Duplicate payment with negative amount
+              newPayment = createPayment(newPayment, inverseOrder, paymentPaymentMethod,
+                  negativeAmount, paymentDocumentType, financialAccount, paymentDocumentNo);
+              paymentTotalAmount = paymentTotalAmount.add(negativeAmount);
+              inversePaymentCreated = true;
+            }
+
+            // Create if needed a second payment for the partially paid
+            BigDecimal outstandingAmount = paymentSchedule.getOutstandingAmount();
+            if (outstandingAmount.compareTo(BigDecimal.ZERO) != 0) {
+
+              // Duplicate payment with positive amount
+              newPayment = createPayment(newPayment, oldOrder, paymentPaymentMethod,
+                  outstandingAmount, paymentDocumentType, financialAccount, paymentDocumentNo);
+              description += ": " + oldOrder.getDocumentNo() + "\n";
+              paymentTotalAmount = paymentTotalAmount.add(outstandingAmount);
+            }
+
+            // Set amount and used credit to zero
+            newPayment.setAmount(paymentTotalAmount);
+            newPayment.setUsedCredit(BigDecimal.ZERO);
+            newPayment.setDescription(description);
+            OBDal.getInstance().save(newPayment);
+
+            OBDal.getInstance().flush();
+
+            // Call to processPayment in order to process it
+            if (replaceOrder) {
+              TriggerHandler.getInstance().enable();
+            }
+            FIN_PaymentProcess.doProcessPayment(newPayment, "P", null, null);
+            if (replaceOrder) {
+              TriggerHandler.getInstance().disable();
+            }
+
+            if (jsonorder != null && jsonorder.has("obposAppCashup")) {
+              // retrieve the transactions of this payment and set the cashupId to those
+              // transactions
+              final List<FIN_FinaccTransaction> newTransactions = newPayment
+                  .getFINFinaccTransactionList();
+              final String cashupId = jsonorder.getString("obposAppCashup");
+              final OBPOSAppCashup cashup = OBDal.getInstance().get(OBPOSAppCashup.class, cashupId);
+              for (FIN_FinaccTransaction transaction : newTransactions) {
+                transaction.setObposAppCashup(cashup);
+              }
+            }
+          }
+          // There aren't any payments on original order, pay original order and inverse order
+          // completely.
+          if (paymentScheduleDetailList.size() == 0) {
+            finishOrderPayments(jsonorder, oldOrder, inverseOrder, paymentSchedule,
+                useOrderDocumentNoForRelatedDocs, triggersDisabled, replaceOrder);
+          }
+        } else {
+          // To only cancel a layaway two payments must be added to fully pay the old order and add
+          // the same quantity in negative to the inverse order
+          if (jsonorder.getJSONArray("payments").length() > 0) {
+            WeldUtils.getInstanceFromStaticBeanManager(CancelLayawayPaymentsHookCaller.class)
+                .executeHook(jsonorder, inverseOrder);
+
+            // In a cancel layaway the gross value of the jsonorder was the quantity amount to
+            // return
+            // to the customer, not the quantity amount of the ticket. This generates that the
+            // amount
+            // and outstandig amount of the payment schedule is wrong
+            // The amount and outstanding amount are corrected
+            OBCriteria<FIN_PaymentSchedule> newPaymentScheduleList = OBDal.getInstance()
+                .createCriteria(FIN_PaymentSchedule.class);
+            newPaymentScheduleList.add(Restrictions.eq(FIN_PaymentSchedule.PROPERTY_ORDER,
+                inverseOrder));
+            newPaymentScheduleList.setMaxResults(1);
+            FIN_PaymentSchedule newPaymentSchedule = (FIN_PaymentSchedule) newPaymentScheduleList
+                .uniqueResult();
+            newPaymentSchedule.setAmount(paymentSchedule.getAmount().negate());
+            newPaymentSchedule.setOutstandingAmount(newPaymentSchedule.getAmount().subtract(
+                newPaymentSchedule.getPaidAmount()));
+          }
+
+          finishOrderPayments(jsonorder, oldOrder, inverseOrder, paymentSchedule,
+              useOrderDocumentNoForRelatedDocs, triggersDisabled, replaceOrder);
+        }
+
+      } else {
+        throw new OBException("There is no payment plan for the order: " + oldOrder.getId());
+      }
+
+    } catch (Exception e1) {
+      log4j.error("Error in CancelAndReplaceUtils.createPayments", e1);
+      try {
+        OBDal.getInstance().getConnection().rollback();
+      } catch (Exception e2) {
+        throw new OBException(e2);
+      }
+      Throwable e3 = DbUtility.getUnderlyingSQLException(e1);
+      throw new OBException(e3);
+    }
+  }
+
+  // Create payments to pay complete fully the order, in the inverse order and old order
+  private static void finishOrderPayments(JSONObject jsonorder, Order oldOrder, Order inverseOrder,
+      FIN_PaymentSchedule paymentSchedule, boolean useOrderDocumentNoForRelatedDocs,
+      boolean triggersDisabled, boolean replaceOrder) throws Exception {
+    FIN_Payment newPayment = null;
+    String paymentDocumentNo = null;
+    FIN_PaymentMethod paymentPaymentMethod = null;
+    FIN_FinancialAccount financialAccount = null;
+    if (jsonorder != null) {
+      paymentPaymentMethod = (FIN_PaymentMethod) jsonorder.getJSONObject("defaultPaymentType").get(
+          "paymentMethod");
+      financialAccount = (FIN_FinancialAccount) jsonorder.getJSONObject("defaultPaymentType").get(
+          "financialAccount");
+    } else {
+      paymentPaymentMethod = oldOrder.getPaymentMethod();
+      financialAccount = oldOrder.getBusinessPartner().getAccount();
+    }
+
+    BigDecimal negativeAmount = paymentSchedule.getOutstandingAmount().negate();
+    BigDecimal outstandingAmount = paymentSchedule.getOutstandingAmount();
+    final DocumentType paymentDocumentType = FIN_Utility.getDocumentType(
+        oldOrder.getOrganization(), AcctServer.DOCTYPE_ARReceipt);
+    if (paymentDocumentType == null) {
+      throw new OBException("No document type found for the new payment");
+    }
+
+    paymentDocumentNo = getPaymentDocumentNo(useOrderDocumentNoForRelatedDocs, oldOrder,
+        paymentDocumentType);
+
+    // Get Payment Description
+    String description = getPaymentDescription();
+    description += ": " + inverseOrder.getDocumentNo();
+
+    // Duplicate payment with negative amount
+    newPayment = createPayment(newPayment, inverseOrder, paymentPaymentMethod, negativeAmount,
+        paymentDocumentType, financialAccount, paymentDocumentNo);
+
+    // Create if needed a second payment for the partially paid
+    if (outstandingAmount.compareTo(BigDecimal.ZERO) != 0) {
+
+      // Duplicate payment with positive amount
+      newPayment = createPayment(newPayment, oldOrder, paymentPaymentMethod, outstandingAmount,
+          paymentDocumentType, financialAccount, paymentDocumentNo);
+      description += ": " + oldOrder.getDocumentNo() + "\n";
+    }
+
+    // Set amount and used credit to zero
+    newPayment.setAmount(BigDecimal.ZERO);
+    newPayment.setUsedCredit(BigDecimal.ZERO);
+    newPayment.setDescription(description);
+    OBDal.getInstance().save(newPayment);
+
+    OBDal.getInstance().flush();
+
+    // Call to processPayment in order to process it
+    if (replaceOrder) {
+      TriggerHandler.getInstance().enable();
+    }
+    FIN_PaymentProcess.doProcessPayment(newPayment, "P", null, null);
+    if (replaceOrder) {
+      TriggerHandler.getInstance().disable();
+    }
+  }
+
+  protected static FIN_Payment createPayment(FIN_Payment payment, Order order,
+      FIN_PaymentMethod paymentPaymentMethod, BigDecimal amount, DocumentType paymentDocumentType,
+      FIN_FinancialAccount financialAccount, String paymentDocumentNo) throws Exception {
+    FIN_Payment newPayment = payment;
+
+    // Get the payment schedule of the order
+    FIN_PaymentSchedule paymentSchedule = null;
+    OBCriteria<FIN_PaymentSchedule> paymentScheduleCriteria = OBDal.getInstance().createCriteria(
+        FIN_PaymentSchedule.class);
+    paymentScheduleCriteria.add(Restrictions.eq(FIN_PaymentSchedule.PROPERTY_ORDER, order));
+    paymentScheduleCriteria.setMaxResults(1);
+    paymentSchedule = (FIN_PaymentSchedule) paymentScheduleCriteria.uniqueResult();
+    if (paymentSchedule == null) {
+      // Create a Payment Schedule if the order hasn't got
+      paymentSchedule = OBProvider.getInstance().get(FIN_PaymentSchedule.class);
+      paymentSchedule.setClient(order.getClient());
+      paymentSchedule.setOrganization(order.getOrganization());
+      paymentSchedule.setCurrency(order.getCurrency());
+      paymentSchedule.setOrder(order);
+      paymentSchedule.setFinPaymentmethod(order.getBusinessPartner().getPaymentMethod());
+      paymentSchedule.setAmount(amount);
+      paymentSchedule.setOutstandingAmount(amount);
+      paymentSchedule.setDueDate(order.getOrderDate());
+      paymentSchedule.setExpectedDate(order.getOrderDate());
+      if (ModelProvider.getInstance().getEntity(FIN_PaymentSchedule.class)
+          .hasProperty("origDueDate")) {
+        // This property is checked and set this way to force compatibility with both MP13, MP14
+        // and
+        // later releases of Openbravo. This property is mandatory and must be set. Check issue
+        paymentSchedule.set("origDueDate", paymentSchedule.getDueDate());
+      }
+      paymentSchedule.setFINPaymentPriority(order.getFINPaymentPriority());
+      OBDal.getInstance().save(paymentSchedule);
+    }
+
+    // Get the payment schedule detail of the order
+    OBCriteria<FIN_PaymentScheduleDetail> paymentScheduleDetailCriteria = OBDal.getInstance()
+        .createCriteria(FIN_PaymentScheduleDetail.class);
+    paymentScheduleDetailCriteria.add(Restrictions.eq(
+        FIN_PaymentScheduleDetail.PROPERTY_ORDERPAYMENTSCHEDULE, paymentSchedule));
+    // There should be only one with null paymentDetails
+    paymentScheduleDetailCriteria.add(Restrictions
+        .isNull(FIN_PaymentScheduleDetail.PROPERTY_PAYMENTDETAILS));
+    List<FIN_PaymentScheduleDetail> paymentScheduleDetailList = paymentScheduleDetailCriteria
+        .list();
+    if (paymentScheduleDetailList.size() != 0) {
+      HashMap<String, BigDecimal> paymentScheduleDetailAmount = new HashMap<String, BigDecimal>();
+      String paymentScheduleDetailId = paymentScheduleDetailList.get(0).getId();
+      paymentScheduleDetailAmount.put(paymentScheduleDetailId, amount);
+
+      if (payment == null) {
+        // Call to savePayment in order to create a new payment in
+        newPayment = FIN_AddPayment.savePayment(payment, true, paymentDocumentType,
+            paymentDocumentNo, order.getBusinessPartner(), paymentPaymentMethod, financialAccount,
+            amount.toPlainString(), order.getOrderDate(), order.getOrganization(), null,
+            paymentScheduleDetailList, paymentScheduleDetailAmount, false, false,
+            order.getCurrency(), BigDecimal.ZERO, BigDecimal.ZERO);
+      }
+      // Create a new line
+      else {
+        FIN_AddPayment.updatePaymentDetail(paymentScheduleDetailList.get(0), newPayment, amount,
+            false);
+      }
+
+    } else {
+      // Two possibilities
+      // 1.- All the payments have been created
+      // 2.- The payment was created trough Web POS and therefore a payment schedule detail with
+      // null payment detail is missing
+      // Lets assume that in this point the payment was created trough Web POS
+      // Create missing payment schedule detail
+      FIN_PaymentScheduleDetail paymentScheduleDetail = OBProvider.getInstance().get(
+          FIN_PaymentScheduleDetail.class);
+      paymentScheduleDetail.setOrganization(order.getOrganization());
+      paymentScheduleDetail.setOrderPaymentSchedule(paymentSchedule);
+      OBDal.getInstance().save(paymentScheduleDetail);
+      paymentScheduleDetailList.add(paymentScheduleDetail);
+
+      // Continue with the payment
+      HashMap<String, BigDecimal> paymentScheduleDetailAmount = new HashMap<String, BigDecimal>();
+      String paymentScheduleDetailId = paymentScheduleDetail.getId();
+      paymentScheduleDetailAmount.put(paymentScheduleDetailId, amount);
+      if (payment == null) {
+        // Call to savePayment in order to create a new payment in
+        newPayment = FIN_AddPayment.savePayment(payment, true, paymentDocumentType,
+            paymentDocumentNo, order.getBusinessPartner(), paymentPaymentMethod, financialAccount,
+            amount.toPlainString(), order.getOrderDate(), order.getOrganization(), null,
+            paymentScheduleDetailList, paymentScheduleDetailAmount, false, false,
+            order.getCurrency(), BigDecimal.ZERO, BigDecimal.ZERO);
+      }
+      // Create a new line
+      else {
+        FIN_AddPayment.updatePaymentDetail(paymentScheduleDetail, newPayment, amount, false);
+      }
+    }
+    return newPayment;
+  }
+
+  protected static String getPaymentDescription() {
+    String language = RequestContext.get().getVariablesSecureApp().getLanguage();
+    String paymentDescription = Utility.messageBD(new DalConnectionProvider(false),
+        "OrderDocumentno", language);
+    return paymentDescription;
+  }
+
+  protected static String getDocumentNo(Entity entity, DocumentType doctypeTarget,
+      DocumentType doctype) {
+    return Utility.getDocumentNo(OBDal.getInstance().getConnection(false),
+        new DalConnectionProvider(false), RequestContext.get().getVariablesSecureApp(), "", entity
+            .getTableName(), doctypeTarget == null ? "" : doctypeTarget.getId(),
+        doctype == null ? "" : doctype.getId(), false, true);
+  }
+
+  protected static String getPaymentDocumentNo(boolean useOrderDocumentNoForRelatedDocs,
+      Order order, DocumentType paymentDocumentType) {
+    String paymentDocumentNo = null;
+    // Get Payment DocumentNo
+    Entity paymentEntity = ModelProvider.getInstance().getEntity(FIN_Payment.class);
+
+    if (useOrderDocumentNoForRelatedDocs) {
+      paymentDocumentNo = order.getDocumentNo();
+    } else {
+      paymentDocumentNo = getDocumentNo(paymentEntity, null, paymentDocumentType);
+    }
+    return paymentDocumentNo;
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/businessUtility/CancelLayawayPaymentsHook.java	Fri Apr 15 13:24:44 2016 +0200
@@ -0,0 +1,27 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2016 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+ */
+
+package org.openbravo.erpCommon.businessUtility;
+
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.model.common.order.Order;
+
+public interface CancelLayawayPaymentsHook {
+  public void exec(JSONObject jsonorder, Order inverseOrder) throws Exception;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/org/openbravo/erpCommon/businessUtility/CancelLayawayPaymentsHookCaller.java	Fri Apr 15 13:24:44 2016 +0200
@@ -0,0 +1,52 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.0  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2016 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ *************************************************************************
+ */
+
+package org.openbravo.erpCommon.businessUtility;
+
+import java.util.Iterator;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
+import javax.inject.Inject;
+
+import org.codehaus.jettison.json.JSONObject;
+import org.openbravo.model.common.order.Order;
+
+public class CancelLayawayPaymentsHookCaller {
+
+  @Inject
+  @Any
+  private Instance<CancelLayawayPaymentsHook> cancelLayawayPaymentsHook;
+
+  public void executeHook(JSONObject jsonorder, Order inverseOrder) throws Exception {
+    executeHooks(cancelLayawayPaymentsHook, jsonorder, inverseOrder);
+  }
+
+  private void executeHooks(Instance<? extends Object> hooks, JSONObject jsonorder,
+      Order inverseOrder) throws Exception {
+
+    for (Iterator<? extends Object> procIter = hooks.iterator(); procIter.hasNext();) {
+      Object proc = procIter.next();
+      if (proc instanceof CancelLayawayPaymentsHook) {
+        ((CancelLayawayPaymentsHook) proc).exec(jsonorder, inverseOrder);
+      }
+    }
+  }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/js/cancelAndReplaceSalesOrderProcess.js	Fri Apr 15 13:24:44 2016 +0200
@@ -0,0 +1,45 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+OB = OB || {};
+
+OB.CancelAndReplaceSalesOrder = OB.CancelAndReplaceSalesOrder || {};
+
+OB.CancelAndReplaceSalesOrder = {
+  execute: function (params, view) {
+    var selection = params.button.contextView.viewGrid.getSelectedRecords(),
+        tabId = view.view.tabId,
+        callback;
+
+    callback = function (rpcResponse, result, rpcRequest) {
+      result.responseActions._processView = params.button.view;
+      OB.Utilities.Action.executeJSON(result.responseActions, null, null, params.button.view);
+      params.button.closeProcessPopup();
+    };
+    
+    OB.RemoteCallManager.call('org.openbravo.common.actionhandler.CancelAndReplaceSalesOrder', {
+      inpcOrderId: selection[0].id,
+      inpTabId: tabId
+    }, {}, callback);
+  },
+
+  cancelAndReplaceSalesOrder: function (params, view) {
+    OB.CancelAndReplaceSalesOrder.execute(params, view);
+  }
+};
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/js/confirmCancelAndReplaceSalesOrderProcess.js	Fri Apr 15 13:24:44 2016 +0200
@@ -0,0 +1,41 @@
+/*
+ *************************************************************************
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2015 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+
+OB = OB || {};
+
+OB.ConfirmCancelAndReplaceSalesOrder = {
+  execute: function (params, view) {
+    var selection = params.button.contextView.viewGrid.getSelectedRecords(),
+        callback;
+
+    callback = function (rpcResponse, data, rpcRequest) {
+      // close process to refresh the selected record
+      params.button.closeProcessPopup();
+      view.view.messageBar.setMessage(data.message.severity, data.message.title, data.message.text);
+    };
+
+    OB.RemoteCallManager.call('org.openbravo.common.actionhandler.ConfirmCancelAndReplaceSalesOrder', {
+    	inpcOrderId: selection[0].id
+    }, {}, callback);
+  },
+
+  confirmCancelAndReplaceSalesOrder: function (params, view) {
+    OB.ConfirmCancelAndReplaceSalesOrder.execute(params, view);
+  }
+};
\ No newline at end of file