Merged pi-warehouse project.
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Mon, 05 Nov 2012 17:44:56 +0100
changeset 18482 7b3cbd5e4146
parent 18451 d89f1701cb29 (current diff)
parent 18481 ca4cf5720017 (diff)
child 18483 57ad045ff307
child 18839 dcbcd97e71fc
Merged pi-warehouse project.
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_MENU.xml
src-db/database/sourcedata/AD_TAB.xml
src-db/database/sourcedata/AD_TABLE.xml
src-db/database/sourcedata/AD_WINDOW.xml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/referencedata/standard/Core_Warehouse_Rules.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ob:Openbravo xmlns:ob="http://www.openbravo.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <WarehouseRule id="33DAC92D21624E0A9D8C537382F2D28C" identifier="Unique Storage Bin">
+    <id>33DAC92D21624E0A9D8C537382F2D28C</id>
+    <active>true</active>
+    <name>Unique Storage Bin</name>
+    <procedure>M_UNIQUELOCATOR_RULE</procedure>
+    <description>Returns stock of the first storage bin in the warehouse with enough stock.</description>
+  </WarehouseRule>
+  <WarehouseRule id="5F23F9B25A834B78A0549AF028E29051" identifier="Unique Attribute">
+    <id>5F23F9B25A834B78A0549AF028E29051</id>
+    <active>true</active>
+    <name>Unique Attribute</name>
+    <procedure>M_UNIQUEATTRIBUTE_RULE</procedure>
+    <description>Returns stock of the first attribute set instance in the warehouse with enough stock.</description>
+  </WarehouseRule>
+  <WarehouseRule id="F2DEA5B4C39F4423BF0AAC73DABD4146" identifier="Default Warehouse Rule">
+    <id>F2DEA5B4C39F4423BF0AAC73DABD4146</id>
+    <active>true</active>
+    <name>Default Warehouse Rule</name>
+    <procedure>M_WAREHOUSE_DEFAULT_RULE</procedure>
+    <description>Useful to overwrite a warehouse rule defined at warehouse on specific documents.</description>
+  </WarehouseRule>
+</ob:Openbravo>
--- a/src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/model/functions/MA_PRODUCTIONRUN_STANDARD.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -296,7 +296,7 @@
             DECLARE
               v_pinstance_result AD_PInstance.result%TYPE;
               v_pinstance_msg AD_PInstance.errormsg%TYPE;
-              v_UniqueAttConsum CHAR(1);
+              v_warehouse_rule_id VARCHAR2(32);
             BEGIN
               v_AD_Pinstance_ID := GET_UUID();
               INSERT INTO AD_PINSTANCE (
@@ -318,16 +318,14 @@
               AD_PINSTANCE_PARA_INSERT(v_AD_Pinstance_ID, '70', 'TableId', '325', null, null, null, null, null);
               AD_PINSTANCE_PARA_INSERT(v_AD_Pinstance_ID, '80', 'LineNo', null, null, v_PlanLine, null, null, null);
               AD_PINSTANCE_PARA_INSERT(v_AD_Pinstance_ID, '90', 'ProcessID', '800105', null, null, null, null, null);
+              AD_PINSTANCE_PARA_INSERT(v_AD_Pinstance_ID, '100', 'Quantity', null, null, v_DoneQuantity*Cur_WRPUsed.MovementQty, null, null, null);
               
-              SELECT COALESCE(SP.UNIQUEATTCONSUM, 'N')
-                INTO v_UniqueAttConsum
-              FROM MA_WRPHASEPRODUCT WRPP
-                      LEFT JOIN MA_SEQUENCEPRODUCT SP ON WRPP.MA_SEQUENCEPRODUCT_ID = SP.MA_SEQUENCEPRODUCT_ID
-              WHERE MA_WRPHASEPRODUCT_ID = Cur_WRPUsed.MA_WRPhaseProduct_ID;
-              IF (v_UniqueAttConsum='Y') THEN 
-                AD_PINSTANCE_PARA_INSERT(v_AD_Pinstance_ID, '100', 'UniqueAttribute', v_UniqueAttConsum, null, null, null, null, null);
-                AD_PINSTANCE_PARA_INSERT(v_AD_Pinstance_ID, '110', 'Quantity', null, null, v_DoneQuantity*Cur_WRPUsed.MovementQty, null, null, null);
-              END IF;
+              SELECT COALESCE(wrpp.m_warehouse_rule_id, sp.m_warehouse_rule_id) INTO v_warehouse_rule_id
+              FROM ma_wrphaseproduct wrpp
+                  JOIN ma_sequenceproduct sp ON wrpp.ma_sequenceproduct_id = sp.ma_sequenceproduct_id
+              WHERE wrpp.ma_wrphaseproduct_id = cur_wrpused.ma_wrphaseproduct_id;
+              AD_PINSTANCE_PARA_INSERT(v_AD_Pinstance_ID, '110', 'M_Warehouse_Rule_ID', v_warehouse_rule_id, null, null, null, null, null);
+
               M_GET_STOCK(v_AD_Pinstance_ID, 'N');
               -- Check result
               SELECT result, errormsg
--- a/src-db/database/model/functions/M_GET_STOCK.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/model/functions/M_GET_STOCK.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -27,31 +27,32 @@
   v_ResultStr VARCHAR2(2000):='';
   v_Message VARCHAR2(2000):='';
   v_Record_ID VARCHAR2(32);
+  v_result NUMBER:=1;
   
   -- Parameter
   TYPE RECORD IS REF CURSOR;
   Cur_Parameter RECORD;
   Cur_Stock RECORD;
   Cur_MStock RECORD;
+  cur_warehouse RECORD;
 
   -- Parameter Variables
   v_Quantity NUMBER(10);
   v_ProductID   VARCHAR2(32);
   v_LocatorID   VARCHAR2(32);
   v_WarehouseID VARCHAR2(32) ;
+  v_PriorityWarehouseID VARCHAR2(32);
   v_OrgID VARCHAR2(32) ;
   v_AttributesetinstanceID  VARCHAR2(32) ;
   v_AD_User_ID VARCHAR2(32) ;
   v_ClientID VARCHAR2(32) ;
-  v_UniqueAttribute CHAR(1);
+  v_warehouse_rule_id VARCHAR2(32);
   v_UomID VARCHAR2(32) ;
   v_ProductUomID VARCHAR2(32) ;
   v_TableID  VARCHAR2(32):='-1';
   v_AuxID VARCHAR2(32):='-1';
   v_LineNo NUMBER;
-  v_SelectedAttSetInstanceID VARCHAR2(32) ;
   v_Count NUMBER:=1;
-  v_ProductName M_Product.NAME%TYPE;
   v_ProcessID VARCHAR2(32) ;
   
 BEGIN
@@ -63,63 +64,59 @@
 
   -- Get Parameters
   v_ResultStr:='ReadingParameters';
-  FOR Cur_Parameter IN
-    (SELECT i.Record_ID,
-      p.ParameterName,
-      p.P_String,
-      p.P_Number,
-      p.P_Date,
-      i.CreatedBy AS AD_User_ID
-    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
+  FOR Cur_Parameter IN (
+      SELECT i.record_id, p.parametername, p.p_string, p.p_number, p.p_date, i.createdby AS ad_user_id
+      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_AD_User_ID:=Cur_Parameter.AD_User_ID;
-    
-    IF(Cur_Parameter.ParameterName='Quantity') THEN
+
+    IF (Cur_Parameter.ParameterName = 'Quantity') THEN
       v_Quantity:=Cur_Parameter.P_Number;
       DBMS_OUTPUT.PUT_LINE(' Quantity=' || v_Quantity);
-    ELSIF(Cur_Parameter.ParameterName='M_Product_ID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'M_Product_ID') THEN
       v_ProductID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' M_Product_ID=' || v_ProductID);
-    ELSIF(Cur_Parameter.ParameterName='C_Uom_ID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'C_Uom_ID') THEN
       v_UomID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' C_Uom_ID=' || v_UomID);
-    ELSIF(Cur_Parameter.ParameterName='M_Product_Uom_ID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'M_Product_Uom_ID') THEN
       v_ProductUomID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' M_Product_Uom_ID=' || v_ProductUomID);
-    ELSIF(Cur_Parameter.ParameterName='M_Locator_ID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'M_Locator_ID') THEN
       v_LocatorID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' M_Locator_ID=' || v_LocatorID);    
-    ELSIF(Cur_Parameter.ParameterName='M_Warehouse_ID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'M_Warehouse_ID') THEN
       v_WarehouseID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' M_Warehouse_ID=' || v_WarehouseID);
-    ELSIF(Cur_Parameter.ParameterName='AD_Client_ID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'Priority_Warehouse_ID') THEN
+      v_PriorityWarehouseID:=Cur_Parameter.P_String;
+      DBMS_OUTPUT.PUT_LINE(' Priority_Warehouse_ID=' || v_WarehouseID);
+    ELSIF (Cur_Parameter.ParameterName = 'AD_Client_ID') THEN
       v_ClientID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' AD_Client_ID=' || v_ClientID);
-    ELSIF(Cur_Parameter.ParameterName='AD_Org_ID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'AD_Org_ID') THEN
       v_OrgID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' AD_Org_ID=' || v_OrgID);
-    ELSIF(Cur_Parameter.ParameterName='M_AttributesetInstance_ID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'M_AttributesetInstance_ID') THEN
       v_AttributesetinstanceID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' M_AttributesetInstance_ID=' || v_AttributesetinstanceID);
-    ELSIF(Cur_Parameter.ParameterName='UniqueAttribute') THEN
-      v_UniqueAttribute:=Cur_Parameter.P_String;
-      DBMS_OUTPUT.PUT_LINE(' UniqueAttribute=' || v_UniqueAttribute);
-    ELSIF(Cur_Parameter.ParameterName='TableId') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'M_Warehouse_Rule_ID') THEN
+      v_warehouse_rule_id:=Cur_Parameter.P_String;
+      DBMS_OUTPUT.PUT_LINE(' M_Warehouse_Rule_ID=' || v_warehouse_rule_id);
+    ELSIF (Cur_Parameter.ParameterName = 'TableId') THEN
       v_TableID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' TableId=' || v_TableID);
-    ELSIF(Cur_Parameter.ParameterName='AuxID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'AuxID') THEN
       v_AuxID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' AuxID=' || v_AuxID);    
-    ELSIF(Cur_Parameter.ParameterName='LineNo') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'LineNo') THEN
       v_LineNo:=Cur_Parameter.P_Number;
       DBMS_OUTPUT.PUT_LINE(' LineNo=' || v_LineNo);
-    ELSIF(Cur_Parameter.ParameterName='ProcessID') THEN
+    ELSIF (Cur_Parameter.ParameterName = 'ProcessID') THEN
       v_ProcessID:=Cur_Parameter.P_String;
       DBMS_OUTPUT.PUT_LINE(' ProcessID=' || v_ProcessID);
     ELSE
@@ -128,82 +125,73 @@
   END LOOP; -- Get Parameter
   DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
 
-        -- Insert Values from Auxiliar STOCK
-
-    FOR Cur_Stock  IN
-    (
-      SELECT MS.M_STORAGE_DETAIL_ID, COALESCE(MS.Quantity, 0) AS Qty, MS.QtyOrder AS QtyOrder, MS.UPDATED AS lastupdated
-      FROM M_STORAGE_DETAIL T        
-       JOIN M_STOCK_AUX MS ON T.M_STORAGE_DETAIL_ID = MS.M_STORAGE_DETAIL_ID
-       JOIN M_LOCATOR L ON T.M_LOCATOR_ID=L.M_LOCATOR_ID
-       JOIN M_WAREHOUSE W ON L.M_WAREHOUSE_ID = W.M_WAREHOUSE_ID
-                LEFT JOIN M_PRODUCT_UOM PU ON T.M_PRODUCT_UOM_ID = PU.M_PRODUCT_UOM_ID
-                LEFT JOIN C_UOM U ON PU.C_UOM_ID = U.C_UOM_ID
-        WHERE T.M_PRODUCT_ID=v_ProductID
-        AND MS.AUX_ID = v_AuxID
-        AND MS.AD_TABLE_ID = v_TableID
-        AND MS.LINE < v_LineNo
-        AND COALESCE(T.C_UOM_ID, '-1') = COALESCE(v_UomID, T.C_UOM_ID, '-1')
-        AND COALESCE(T.M_Product_UOM_id, '-1') = COALESCE(v_ProductUomID, T.M_Product_UOM_id, '-1')
-        AND COALESCE(T.M_ATTRIBUTESETINSTANCE_ID, '-1') = COALESCE(v_AttributesetinstanceID, T.M_ATTRIBUTESETINSTANCE_ID, '-1')
-        AND COALESCE(L.M_LOCATOR_ID, '-1') = COALESCE(v_LocatorID, L.M_LOCATOR_ID, '-1')
-        AND COALESCE(W.M_WAREHOUSE_ID, '-1') = COALESCE(v_WarehouseID, W.M_WAREHOUSE_ID, '-1')
-        AND ((AD_ISORGINCLUDED(W.AD_ORG_ID,v_OrgID,W.AD_CLIENT_ID)<>-1) OR (AD_ISORGINCLUDED(v_OrgID,W.AD_ORG_ID,W.AD_CLIENT_ID)<>-1))
-        AND COALESCE(MS.Quantity, 0)>0
-        ORDER BY PRIORITYNO, LASTUPDATED
-      )
-      LOOP
-        INSERT 
-        INTO M_STOCK_PROPOSED
-        (
+  -- Insert Values from Auxiliar STOCK
+  FOR Cur_Stock IN (
+      SELECT ms.m_storage_detail_id, COALESCE(ms.quantity, 0) AS qty, ms.qtyorder AS qtyorder, ms.UPDATED AS lastupdated
+      FROM m_storage_detail t
+          JOIN m_stock_aux ms ON t.m_storage_detail_id = ms.m_storage_detail_id
+          JOIN m_locator l ON t.m_locator_id = l.m_locator_id
+          JOIN m_warehouse w ON l.m_warehouse_id = w.m_warehouse_id
+          JOIN ad_org_warehouse ow ON w.m_warehouse_id = ow.m_warehouse_id
+          LEFT JOIN m_attributesetinstance asi ON t.m_attributesetinstance_id = asi.m_attributesetinstance_id
+          LEFT JOIN m_product_uom pu ON t.m_product_uom_id = pu.m_product_uom_id
+          LEFT JOIN c_uom u ON pu.c_uom_id = u.c_uom_id
+      WHERE t.m_product_id = v_productid
+        AND ms.aux_id = v_auxid
+        AND ms.ad_table_id = v_tableid
+        AND ms.line < v_lineno
+        AND COALESCE(t.c_uom_id, '-1') = COALESCE(v_uomid, t.c_uom_id, '-1')
+        AND COALESCE(t.m_product_uom_id, '-1') = COALESCE(v_productuomid, t.m_product_uom_id, '-1')
+        AND COALESCE(t.m_attributesetinstance_id, '-1') = COALESCE(v_attributesetinstanceid, t.m_attributesetinstance_id, '-1')
+        AND COALESCE(l.m_locator_id, '-1') = COALESCE(v_locatorid, l.m_locator_id, '-1')
+        AND COALESCE(w.m_warehouse_id, '-1') = COALESCE(v_warehouseid, w.m_warehouse_id, '-1')
+        AND ow.ad_org_id = v_orgid
+        AND COALESCE(ms.quantity, 0)>0
+      ORDER BY CASE w.m_warehouse_id WHEN COALESCE(v_PriorityWarehouseID, '-1') THEN 0 ELSE 1 END, ow.priority, l.priorityno, asi.created, t.created
+  ) LOOP
+    INSERT INTO m_stock_proposed (
         m_stock_proposed_id, ad_client_id, ad_org_id, isactive, 
         created , createdby, updated, updatedby,
         ad_pinstance_id, priority, m_storage_detail_id, quantity, qtyorder
-        )
-        VALUES
-        (
+    ) VALUES (
         get_uuid(), v_ClientID, v_OrgID, 'Y',
         now(), v_AD_User_ID, now(), v_AD_User_ID,
         pinstance_id, v_Count, Cur_Stock.M_STORAGE_DETAIL_ID, Cur_Stock.Qty, Cur_Stock.qtyorder
-        );
-        v_Count:=v_Count+1;
-      END LOOP;
+    );
+    v_Count:=v_Count+1;
+  END LOOP;
 
-    -- Insert Values from Storage Detail
-    FOR Cur_Stock  IN
-    (
-      SELECT T.M_STORAGE_DETAIL_ID, COALESCE(T.QtyOnHand, 0) AS Qty, T.QtyOrderOnHand AS QtyOrder, L.PRIORITYNO, T.UPDATED AS lastupdated
-      FROM M_STORAGE_DETAIL T 
-       JOIN M_LOCATOR L ON T.M_LOCATOR_ID=L.M_LOCATOR_ID
-       JOIN M_WAREHOUSE W ON L.M_WAREHOUSE_ID = W.M_WAREHOUSE_ID
-       LEFT JOIN M_PRODUCT_UOM PU ON T.M_PRODUCT_UOM_ID = PU.M_PRODUCT_UOM_ID
-       LEFT JOIN C_UOM U ON PU.C_UOM_ID = U.C_UOM_ID
-      WHERE T.M_PRODUCT_ID=v_ProductID
-        AND COALESCE(T.C_UOM_ID, '-1') = COALESCE(v_UomID, T.C_UOM_ID, '-1')
-        AND COALESCE(T.M_Product_UOM_id, '-1') = COALESCE(v_ProductUomID, T.M_Product_UOM_id, '-1')
-        AND COALESCE(T.M_ATTRIBUTESETINSTANCE_ID, '-1') = COALESCE(v_AttributesetinstanceID, T.M_ATTRIBUTESETINSTANCE_ID, '-1')
-        AND COALESCE(L.M_LOCATOR_ID, '-1') = COALESCE(v_LocatorID, L.M_LOCATOR_ID, '-1')
-        AND COALESCE(W.M_WAREHOUSE_ID, '-1') = COALESCE(v_WarehouseID, W.M_WAREHOUSE_ID, '-1')
-        AND ((AD_ISORGINCLUDED(W.AD_ORG_ID,v_OrgID,W.AD_CLIENT_ID)<>-1) OR (AD_ISORGINCLUDED(v_OrgID,W.AD_ORG_ID,W.AD_CLIENT_ID)<>-1))
-        AND COALESCE(T.QtyOnHand, 0)>0
-        ORDER BY PRIORITYNO, LASTUPDATED
-      )
-      LOOP
-        INSERT 
-        INTO M_STOCK_PROPOSED
-        (
+  -- Insert Values from Storage Detail
+  FOR Cur_Stock  IN (
+      SELECT t.m_storage_detail_id, COALESCE(t.qtyonhand, 0) AS qty, t.qtyorderonhand AS qtyorder, l.priorityno, t.UPDATED AS lastupdated
+      FROM m_storage_detail t 
+          JOIN m_locator l ON t.m_locator_id=l.m_locator_id
+          JOIN m_warehouse w ON l.m_warehouse_id = w.m_warehouse_id
+          JOIN ad_org_warehouse ow ON w.m_warehouse_id = ow.m_warehouse_id
+          LEFT JOIN m_attributesetinstance asi ON t.m_attributesetinstance_id = asi.m_attributesetinstance_id
+          LEFT JOIN m_product_uom pu ON t.m_product_uom_id = pu.m_product_uom_id
+          LEFT JOIN c_uom u ON pu.c_uom_id = u.c_uom_id
+      WHERE t.m_product_id=v_productid
+        AND COALESCE(t.c_uom_id, '-1') = COALESCE(v_uomid, t.c_uom_id, '-1')
+        AND COALESCE(t.m_product_uom_id, '-1') = COALESCE(v_productuomid, t.m_product_uom_id, '-1')
+        AND COALESCE(t.m_attributesetinstance_id, '-1') = COALESCE(v_attributesetinstanceid, t.m_attributesetinstance_id, '-1')
+        AND COALESCE(l.m_locator_id, '-1') = COALESCE(v_locatorid, l.m_locator_id, '-1')
+        AND COALESCE(w.m_warehouse_id, '-1') = COALESCE(v_warehouseid, w.m_warehouse_id, '-1')
+        AND ow.ad_org_id = v_orgid
+        AND COALESCE(t.qtyonhand, 0)>0
+      ORDER BY CASE w.m_warehouse_id WHEN COALESCE(v_PriorityWarehouseID, '-1') THEN 0 ELSE 1 END, ow.priority, l.priorityno, asi.created, t.created
+  ) LOOP
+    INSERT INTO m_stock_proposed (
         m_stock_proposed_id, ad_client_id, ad_org_id, isactive, 
         created , createdby, updated, updatedby,
         ad_pinstance_id, priority, m_storage_detail_id, quantity, qtyorder
-        )
-        VALUES
-        (
+    ) VALUES (
         get_uuid(), v_ClientID, v_OrgID, 'Y',
         now(), v_AD_User_ID, now(), v_AD_User_ID,
         pinstance_id, v_Count, Cur_Stock.M_STORAGE_DETAIL_ID, Cur_Stock.Qty, Cur_Stock.QtyOrder
-        );
-        v_Count:=v_Count+1;
-      END LOOP;
+    );
+    v_Count:=v_Count+1;
+  END LOOP;
 
   --M_Get_Stock - Finish Process Extension Point
   SELECT count(*) INTO v_count
@@ -235,62 +223,55 @@
       WHERE ad_ep_instance_id = v_ep_instance;
     END;
   END IF;
-
-
-  IF (v_UniqueAttribute='Y') THEN
-    DELETE FROM M_STOCK_PROPOSED MS
-    WHERE AD_PINSTANCE_ID = pinstance_id
-      AND EXISTS (SELECT '1'
-      FROM M_STORAGE_DETAIL T
-      WHERE T.M_STORAGE_DETAIL_ID = MS.M_STORAGE_DETAIL_ID
-      AND T.M_ATTRIBUTESETINSTANCE_ID = '0'
-      ); 
-    v_SelectedAttSetInstanceID:=null;
-
-    FOR Cur_MStock IN (
-        SELECT A.M_ATTRIBUTESETINSTANCE_ID
-        FROM (
-          SELECT SUM(MS.QUANTITY) AS QTY, T.M_ATTRIBUTESETINSTANCE_ID, MIN(PRIORITY) AS PRIORITY
-          FROM M_STOCK_PROPOSED MS
-               JOIN M_STORAGE_DETAIL T ON MS.M_STORAGE_DETAIL_ID = T.M_STORAGE_DETAIL_ID
-          WHERE AD_PINSTANCE_ID = pinstance_id
-          GROUP BY T.M_ATTRIBUTESETINSTANCE_ID
-          HAVING SUM(MS.QUANTITY) >= v_Quantity
-          ) A
-        ORDER BY A.PRIORITY
+  
+  -- Apply stock rules
+  DECLARE
+    v_sql VARCHAR2(2000);
+    v_applyrule CHAR(1);
+  BEGIN
+    FOR cur_warehouse IN (
+        SELECT l.m_warehouse_id, wr.procedurename, wr.m_warehouse_rule_id
+        FROM m_stock_proposed sp
+            JOIN m_storage_detail sd ON sp.m_storage_detail_id = sd.m_storage_detail_id
+            JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
+            JOIN m_warehouse w ON l.m_warehouse_id = w.m_warehouse_id
+            JOIN m_warehouse_rule wr ON wr.m_warehouse_rule_id = COALESCE(v_warehouse_rule_id, w.m_warehouse_rule_id)
+        WHERE ad_pinstance_id = pinstance_id
+        GROUP BY l.m_warehouse_id, wr.m_warehouse_rule_id, wr.procedurename
+        ORDER BY MIN(sp.priority)
     ) LOOP
-      v_SelectedAttSetInstanceID := Cur_MStock.M_ATTRIBUTESETINSTANCE_ID;
-      EXIT;
+      IF (AD_GET_RDBMS() = 'ORACLE') THEN
+        v_Sql := 'CALL ' || cur_warehouse.procedurename || '('''||pinstance_id||''', '''||cur_warehouse.m_warehouse_id||''')';
+      ELSE
+        v_Sql := 'SELECT ' || cur_warehouse.procedurename || '('''||pinstance_id||''', '''||cur_warehouse.m_warehouse_id||''') FROM DUAL';
+      END IF;
+      BEGIN
+        EXECUTE IMMEDIATE v_Sql;
+      EXCEPTION WHEN OTHERS THEN
+        DBMS_OUTPUT.PUT_LINE('ERROR EXECUTING STOCK RULE PROCEDURE');
+      END;
+      SELECT result, errormsg INTO v_result, v_message
+      FROM ad_pinstance
+      WHERE ad_pinstance_id = pinstance_id;
+      IF (v_result = 0) THEN
+        RAISE_APPLICATION_ERROR(-20000, v_message);
+      END IF;
     END LOOP;
-
-    IF (v_SelectedAttSetInstanceID is NULL) THEN
-      -- Return with error result. Not enough stocked with unique attribute.
-      SELECT name INTO v_productname
-      FROM m_product
-      WHERE m_product_id = v_productid;
-      v_Message := '@Product@: ' || v_productname ||'. @NotEnoughAttUniqueStock@';
-      AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 0, v_Message, p_calledfromapp) ;
-      RETURN;
-    ELSE
-      DELETE FROM M_STOCK_PROPOSED MS
-      WHERE AD_PINSTANCE_ID = pinstance_id
-        AND EXISTS (SELECT '1'
-                    FROM M_STORAGE_DETAIL T
-                    WHERE T.M_STORAGE_DETAIL_ID = MS.M_STORAGE_DETAIL_ID
-                      AND T.M_ATTRIBUTESETINSTANCE_ID <> v_SelectedAttSetInstanceID
-                   );
-    END IF;
-  END IF;
+  END;
 
   --  Update AD_PInstance
   DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
-  AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 1, v_Message, p_calledfromapp) ;
+  AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', v_result, v_Message, p_calledfromapp) ;
   RETURN;
 END; --BODY
 EXCEPTION
 WHEN OTHERS THEN
   DBMS_OUTPUT.PUT_LINE(v_ResultStr) ;
-  v_ResultStr:= '@ERROR=' || SQLERRM;
+  IF (SQLERRM LIKE '@ERROR=%') THEN
+    v_resultstr := SQLERRM;
+  ELSE
+    v_ResultStr:= '@ERROR=' || SQLERRM;
+  END IF;
   DBMS_OUTPUT.PUT_LINE(v_ResultStr) ;
   AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 0, v_ResultStr, p_calledfromapp);
   IF (p_calledfromapp = 'Y') THEN
--- a/src-db/database/model/functions/M_INOUT_CREATE.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/model/functions/M_INOUT_CREATE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -34,7 +34,7 @@
   * parts created by ComPiere are Copyright (C) ComPiere, Inc.;
   * All Rights Reserved.
   * Contributor(s): Openbravo SLU
-  * Contributions are Copyright (C) 2001-2010 Openbravo, S.L.U.
+  * Contributions are Copyright (C) 2001-2012 Openbravo, S.L.U.
   *
   * Specifically, this derivative work is based upon the following Compiere
   * file and version.
@@ -69,20 +69,8 @@
   -- Parameter
   TYPE RECORD IS REF CURSOR;
     Cur_Parameter RECORD;
-    -- Record Info
-    v_AD_Org_ID VARCHAR2(32);
-    v_AD_Client_ID VARCHAR2(32);
-    v_allownegativestock CHAR(1);
-    v_order_count NUMBER:=0;
-    v_order_delivered_count NUMBER:=0;
-    v_order_partial_count NUMBER:= 0;
-    v_Record_ID VARCHAR2(32):=NULL;
-    v_Selection VARCHAR2(1):='N';
-    v_hasPartial BOOLEAN := false;
-    v_User_ID VARCHAR2(32):='0';
     -- Orders to process  - one per warehouse
     Cur_Order RECORD;
-    v_NEWORDERDATE DATE;
     -- Order Lines per Warehouse
     CURSOR Cur_OrderLine (Order_ID VARCHAR, Warehouse_ID VARCHAR) IS
     SELECT l.*, p.name
@@ -98,128 +86,160 @@
     ORDER BY l.line, l.M_Product_ID, l.M_Warehouse_id, l.c_uom_id, l.m_attributesetinstance_id, 
       l.m_product_uom_id, qtyordered-qtydelivered;
     ol Cur_OrderLine%ROWTYPE;
-    CURSOR Cur_Storage (p_Product varchar, p_Warehouse varchar, p_UOM varchar, p_Product_UOM varchar, p_Attribute varchar) IS
-    SELECT T.C_UOM_ID,
-      T.M_LOCATOR_ID,
-      T.M_ATTRIBUTESETINSTANCE_ID,
-      T.M_PRODUCT_UOM_ID,
-      COALESCE(T.QtyOnHand, 0) AS QtyOnHand,
-      T.QtyOrderOnHand AS QtyOrder
-    FROM M_STORAGE_DETAIL T LEFT OUTER JOIN
-      M_ATTRIBUTESETINSTANCE A
-      ON T.M_ATTRIBUTESETINSTANCE_ID = A.M_ATTRIBUTESETINSTANCE_ID,
-      M_LOCATOR L
-    WHERE T.M_PRODUCT_ID=p_Product AND
-      T.M_LOCATOR_ID=L.M_LOCATOR_ID AND
-      L.M_WAREHOUSE_ID=p_Warehouse AND
-      T.C_UOM_ID=p_UOM AND
-      COALESCE(T.M_PRODUCT_UOM_ID, '0')=COALESCE(p_Product_UOM, '0') AND
-      COALESCE(T.M_ATTRIBUTESETINSTANCE_ID, '0')=COALESCE(p_Attribute, COALESCE(T.M_ATTRIBUTESETINSTANCE_ID, '0')) AND
-      COALESCE(T.QtyOnHand, 0)>0
-      AND L.ISACTIVE='Y'
-    ORDER BY L.PRIORITYNO,
-      A.CREATED, T.CREATED;
-    
+    CURSOR Cur_Storage (v_ad_pinstance_id varchar) IS
+      SELECT sd.m_product_id, sd.m_locator_id, sd.m_attributesetinstance_id,
+          sd.c_uom_id, sd.m_product_uom_id, u.stdprecision,
+          ms.quantity AS qtyonhand, ms.qtyorder AS qtyorder,
+          ms.priority
+      FROM m_stock_proposed ms 
+            LEFT JOIN m_storage_detail sd ON ms.m_storage_detail_id = sd.m_storage_detail_id
+            LEFT JOIN m_product_uom pu ON sd.m_product_uom_id = pu.m_product_uom_id
+            LEFT JOIN c_uom u ON pu.c_uom_id = u.c_uom_id
+            LEFT JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
+      WHERE ms.ad_pinstance_id = v_ad_pinstance_id
+      ORDER BY ms.priority;
+
     v_storage Cur_Storage%ROWTYPE;
-    --
-    v_NextNo varchar2(32);
-    v_DocType_ID VARCHAR2(32);
-    v_DocumentNo VARCHAR2(40) ;
-    v_Qty NUMBER;
-    --MODIFIED BY F.IRIAZABAL
-    v_QtyOrder NUMBER;
-    v_ProductUOM VARCHAR2(32);
-    v_ActualQty NUMBER;
-    v_QtyAux NUMBER;
-    --
-    v_lines NUMBER:=0;
-    v_lines_per_orderline NUMBER:=0;
-    v_count NUMBER:=0;
-    CREATE_FROM_INVOICE BOOLEAN:=false;
-    Next_Line BOOLEAN:=false;
-    Next_Order BOOLEAN:=false;
-    NEXT_PRODUCT BOOLEAN:=false;
-    FINISH_PROCESS BOOLEAN:=false;
-    Cur_Storage_ISOPEN BOOLEAN:=false;
-    Cur_OrderLine_ISOPEN BOOLEAN:=false;
-  BEGIN
-    -- Process Parameters
-    IF(p_PInstance_ID IS NOT NULL) THEN
-      --  Chec  k for serial execution
-      DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || p_PInstance_ID) ;
-      SELECT COUNT(*)
-      INTO v_count
-      FROM AD_PINSTANCE
-      WHERE AD_PROCESS_ID IN(SELECT AD_PROCESS_ID FROM AD_PINSTANCE WHERE AD_PInstance_ID=p_PInstance_ID)
-        AND IsProcessing='Y'
-        AND AD_PInstance_ID<>p_PInstance_ID;
-      IF(v_count>0) THEN
-        RAISE_APPLICATION_ERROR(-20000, '@SerialProcessStillRunning@') ;
-      END IF;
-      --  Update AD_PInstance
-      DBMS_OUTPUT.PUT_LINE('M_InOut_Create - Processing ' || p_PInstance_ID) ;
-      v_ResultStr:='PInstanceNotFound';
-      AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
-      -- Get Parameters
-      v_ResultStr:='ReadingParameters';
-      FOR Cur_Parameter IN
-        (SELECT i.Record_ID, p.ParameterName, p.P_String, p.P_Number, p.P_Date, 
-          p.AD_CLIENT_ID, ci.allownegativestock, i.AD_User_ID
+
+  -- Record Info
+  v_AD_Org_ID VARCHAR2(32);
+  v_AD_Client_ID VARCHAR2(32);
+  v_allownegativestock CHAR(1);
+  v_order_count NUMBER:=0;
+  v_order_delivered_count NUMBER:=0;
+  v_order_partial_count NUMBER:= 0;
+  v_Record_ID VARCHAR2(32):=NULL;
+  v_Selection VARCHAR2(1):='N';
+  v_hasPartial BOOLEAN := false;
+  v_User_ID VARCHAR2(32):='0';
+  v_NEWORDERDATE DATE;
+  --
+  v_NextNo varchar2(32);
+  v_DocType_ID VARCHAR2(32);
+  v_DocumentNo VARCHAR2(40) ;
+  v_Qty NUMBER;
+  --MODIFIED BY F.IRIAZABAL
+  v_QtyOrder NUMBER;
+  v_ProductUOM VARCHAR2(32);
+  v_ActualQty NUMBER;
+  v_QtyAux NUMBER;
+  --
+  v_lines NUMBER:=0;
+  v_lines_per_orderline NUMBER:=0;
+  v_count NUMBER:=0;
+  CREATE_FROM_INVOICE BOOLEAN:=false;
+  Next_Line BOOLEAN:=false;
+  Next_Order BOOLEAN:=false;
+  NEXT_PRODUCT BOOLEAN:=false;
+  Cur_Storage_ISOPEN BOOLEAN:=false;
+  Cur_OrderLine_ISOPEN BOOLEAN:=false;
+BEGIN
+  -- Process Parameters
+  IF (p_pinstance_id IS NOT NULL) THEN
+    --  Chec  k for serial execution
+    DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || p_PInstance_ID) ;
+    SELECT COUNT(*) INTO v_count
+    FROM AD_PINSTANCE
+    WHERE AD_PROCESS_ID IN(SELECT AD_PROCESS_ID FROM AD_PINSTANCE WHERE AD_PInstance_ID=p_PInstance_ID)
+      AND IsProcessing='Y'
+      AND AD_PInstance_ID<>p_PInstance_ID;
+    IF (v_count>0) THEN
+      RAISE_APPLICATION_ERROR(-20000, '@SerialProcessStillRunning@') ;
+    END IF;
+    --  Update AD_PInstance
+    DBMS_OUTPUT.PUT_LINE('M_InOut_Create - Processing ' || p_PInstance_ID) ;
+    v_ResultStr:='PInstanceNotFound';
+    AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'Y', NULL, NULL) ;
+    -- Get Parameters
+    v_ResultStr:='ReadingParameters';
+    FOR Cur_Parameter IN (
+        SELECT i.Record_ID, p.ParameterName, p.P_String, p.P_Number, p.P_Date,
+            p.AD_CLIENT_ID, ci.allownegativestock, i.AD_User_ID
         FROM AD_ClientInfo ci, AD_PInstance i LEFT JOIN AD_PInstance_Para p ON i.AD_PInstance_ID=p.AD_PInstance_ID
         WHERE i.AD_PInstance_ID=p_PInstance_ID
           AND p.ad_client_id = ci.ad_client_id
-        ORDER BY p.SeqNo) LOOP
-        IF(Cur_Parameter.ParameterName='AD_Org_ID') THEN
-          v_AD_Org_ID:=Cur_Parameter.P_String;
-          DBMS_OUTPUT.PUT_LINE('  AD_Org_ID=' || v_AD_Org_ID) ;
-        ELSIF(Cur_Parameter.ParameterName='Selection') THEN
-          v_Selection:=Cur_Parameter.P_String;
-          DBMS_OUTPUT.PUT_LINE('  Selection=' || v_Selection) ;
-        ELSE
-          DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ;
-        END IF;
-        v_AD_Client_ID:=Cur_Parameter.AD_CLIENT_ID;
-        v_allownegativestock := cur_parameter.allownegativestock;
-        v_Record_ID:=Cur_Parameter.Record_ID;
-        v_User_ID:=Cur_Parameter.AD_User_ID;
-      END LOOP; -- Get Parameter
-      DBMS_OUTPUT.PUT_LINE('  v_Record_ID=' || v_Record_ID) ;
-    ELSIF(p_Invoice_ID IS NOT NULL) THEN
-      CREATE_FROM_INVOICE:=true;
-      SELECT c_invoice.AD_CLIENT_ID, ad_clientinfo.allownegativestock, c_invoice.updatedby
+        ORDER BY p.SeqNo
+    ) LOOP
+      IF (Cur_Parameter.ParameterName = 'AD_Org_ID') THEN
+        v_AD_Org_ID:=Cur_Parameter.P_String;
+        DBMS_OUTPUT.PUT_LINE('  AD_Org_ID=' || v_AD_Org_ID);
+      ELSIF (Cur_Parameter.ParameterName = 'Selection') THEN
+        v_Selection:=Cur_Parameter.P_String;
+        DBMS_OUTPUT.PUT_LINE('  Selection=' || v_Selection);
+      ELSE
+        DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ;
+      END IF;
+      v_AD_Client_ID:=Cur_Parameter.AD_CLIENT_ID;
+      v_allownegativestock := cur_parameter.allownegativestock;
+      v_Record_ID:=Cur_Parameter.Record_ID;
+      v_User_ID:=Cur_Parameter.AD_User_ID;
+    END LOOP; -- Get Parameter
+    DBMS_OUTPUT.PUT_LINE('  v_Record_ID=' || v_Record_ID) ;
+  ELSIF(p_Invoice_ID IS NOT NULL) THEN
+    CREATE_FROM_INVOICE:=true;
+    SELECT c_invoice.ad_client_id, ad_clientinfo.allownegativestock, c_invoice.updatedby
       INTO v_ad_client_id, v_allownegativestock, v_user_id
-      FROM ad_clientinfo, c_invoice
-      where ad_clientinfo.ad_client_id = c_invoice.ad_client_id
-      and c_invoice_id = p_invoice_id;
-    ELSE
-      v_Record_ID:=p_Order_ID;
-      DBMS_OUTPUT.PUT_LINE('--<<M_InOut_Create>> Order_ID=' || v_Record_ID);
-      SELECT c_order.AD_CLIENT_ID, ad_clientinfo.allownegativestock,c_order.updatedby
-      INTO v_ad_client_id, v_allownegativestock, v_user_id
-       FROM ad_clientinfo, c_order
-      where ad_clientinfo.ad_client_id = c_order.ad_client_id
-      and c_order_id = v_Record_ID;
-
+    FROM ad_clientinfo, c_invoice
+    WHERE ad_clientinfo.ad_client_id = c_invoice.ad_client_id
+      AND c_invoice_id = p_invoice_id;
+  ELSE
+    v_Record_ID:=p_Order_ID;
+    DBMS_OUTPUT.PUT_LINE('--<<M_InOut_Create>> Order_ID=' || v_Record_ID);
+    SELECT c_order.ad_client_id, ad_clientinfo.allownegativestock,c_order.updatedby
+    INTO v_ad_client_id, v_allownegativestock, v_user_id
+     FROM ad_clientinfo, c_order
+    WHERE ad_clientinfo.ad_client_id = c_order.ad_client_id
+    AND c_order_id = v_record_id;
+  END IF;
+BEGIN --BODY
+  IF(NOT CREATE_FROM_INVOICE) THEN
+    -- May be NULL or 0
+    IF(v_Record_ID IS NULL) THEN
+      v_Record_ID:='0';
     END IF;
-
-    
-    BEGIN --BODY
-      IF(NOT CREATE_FROM_INVOICE) THEN
-        -- May be NULL or 0
-        IF(v_Record_ID IS NULL) THEN
-          v_Record_ID:='0';
-        END IF;
-        IF(v_Selection IS NULL) THEN
-          v_Selection:='N';
-        END IF;
-      END IF;--CREATE_FROM_INVOICE
-      IF(NOT CREATE_FROM_INVOICE) THEN
-        /**************************************************************************
-        * Order Loop goes though all open orders, where we would need to ship something
-        * (if v_Record_ID = '0')
-        *************************************************************************/
-        FOR Cur_Order IN
-          (SELECT o.AD_Client_ID, o.AD_Org_ID, o.C_Order_ID, o.IsSOTrx,
+    IF(v_Selection IS NULL) THEN
+      v_Selection:='N';
+    END IF;
+    /**************************************************************************
+    * Order Loop goes though all open orders, where we would need to ship something
+    * (if v_Record_ID = '0')
+    *************************************************************************/
+    FOR Cur_Order IN (
+        SELECT o.AD_Client_ID, o.AD_Org_ID, o.C_Order_ID, o.IsSOTrx,
+            o.Description, o.DocumentNo, o.C_DocType_ID, o.C_BPartner_ID,
+            o.C_BPartner_Location_ID, o.AD_User_ID, l.M_Warehouse_ID, o.POReference,
+            o.DateOrdered, o.DeliveryRule, o.FreightCostRule, o.FreightAmt,
+            o.C_Project_ID, o.C_Activity_ID, o.C_Campaign_ID, o.AD_OrgTrx_ID,
+            o.User1_ID, o.User2_ID, o.DeliveryViaRule, o.M_Shipper_ID,
+            o.C_Charge_ID, o.ChargeAmt, o.PriorityRule, o.SALESREP_ID,
+            d.DocSubTypeSO,
+            o.DELIVERY_LOCATION_ID -- Added by Rafa Roda to include delivery location
+        FROM C_ORDER o
+            JOIN C_DOCTYPE d ON o.C_DOCTYPE_ID = d.C_DOCTYPE_ID
+            INNER JOIN C_ORDERLINE l ON o.C_Order_ID = l.C_Order_ID --  Orders are IP  or CO if Standard Orders
+        WHERE(o.DocStatus='IP' OR(o.DocStatus='CO'
+                                  AND o.IsDelivered='N'
+                                  AND v_Record_ID='0')) -- Sales Orders Only and not Offers
+          AND o.IsSOTrx='Y'
+          AND o.C_DocType_ID IN (SELECT C_DocType_ID
+                                 FROM C_DOCTYPE
+                                 WHERE DocBaseType='SOO'
+                                   AND DocSubTypeSO NOT IN('ON', 'OB')
+                                   AND isReturn = 'N')
+          -- Manually Selected
+          AND ((v_Selection='Y' AND o.IsSelected='Y')
+              OR (v_Selection<>'Y' -- Specific or individual organization
+                  AND (v_AD_Org_ID IS NULL OR v_AD_Org_ID=o.AD_Org_ID) -- Specific order or all open orders
+                  AND (o.C_Order_ID=v_Record_ID -- Parameter
+                      OR (v_Record_ID='0'
+                          AND EXISTS (SELECT *
+                                FROM C_ORDERLINE ll
+                                WHERE o.C_Order_ID=ll.C_Order_ID
+                                AND ll.QtyOrdered<>ll.QtyDelivered
+                                AND ll.DirectShip='N'
+                                AND ll.M_Product_ID IS NOT NULL
+            )))))
+        GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_Order_ID, o.IsSOTrx,
              o.Description, o.DocumentNo, o.C_DocType_ID, o.C_BPartner_ID,
              o.C_BPartner_Location_ID, o.AD_User_ID, l.M_Warehouse_ID, o.POReference,
              o.DateOrdered, o.DeliveryRule, o.FreightCostRule, o.FreightAmt,
@@ -228,331 +248,231 @@
              o.C_Charge_ID, o.ChargeAmt, o.PriorityRule, o.SALESREP_ID,
              d.DocSubTypeSO,
              o.DELIVERY_LOCATION_ID -- Added by Rafa Roda to include delivery location
-           FROM C_ORDER o JOIN C_DOCTYPE d ON o.C_DOCTYPE_ID = d.C_DOCTYPE_ID INNER JOIN C_ORDERLINE l ON(o.C_Order_ID=l.C_Order_ID) --  Orders are IP  or CO if Standard Orders
-           WHERE(o.DocStatus='IP' OR(o.DocStatus='CO'
-                                     AND o.IsDelivered='N'
-                                     AND v_Record_ID='0')) -- Sales Orders Only and not Offers
-                 AND o.IsSOTrx='Y'
-                 AND o.C_DocType_ID IN (SELECT C_DocType_ID
-                                        FROM C_DOCTYPE
-                                        WHERE DocBaseType='SOO'
-                                        AND DocSubTypeSO NOT IN('ON', 'OB')
-                                        AND isReturn = 'N'
-                 )
-            -- Manually Selected
-            AND((v_Selection='Y'
-                AND o.IsSelected='Y')
-            OR(v_Selection<>'Y' -- Specific or individual organization
-               AND(v_AD_Org_ID IS NULL OR
-                   v_AD_Org_ID=o.AD_Org_ID) -- Specific order or all open orders
-               AND(o.C_Order_ID=v_Record_ID -- Parameter
-                   OR(v_Record_ID='0'
-                      AND EXISTS (SELECT *
-                                  FROM C_ORDERLINE ll
-                                  WHERE o.C_Order_ID=ll.C_Order_ID
-                                  AND ll.QtyOrdered<>ll.QtyDelivered
-                                  AND ll.DirectShip='N'
-                                  AND ll.M_Product_ID IS NOT NULL
-              )))))
-           GROUP BY o.AD_Client_ID, o.AD_Org_ID, o.C_Order_ID, o.IsSOTrx,
-             o.Description, o.DocumentNo, o.C_DocType_ID, o.C_BPartner_ID,
-             o.C_BPartner_Location_ID, o.AD_User_ID, l.M_Warehouse_ID, o.POReference,
-             o.DateOrdered, o.DeliveryRule, o.FreightCostRule, o.FreightAmt,
-             o.C_Project_ID, o.C_Activity_ID, o.C_Campaign_ID, o.AD_OrgTrx_ID,
-             o.User1_ID, o.User2_ID, o.DeliveryViaRule, o.M_Shipper_ID,
-             o.C_Charge_ID, o.ChargeAmt, o.PriorityRule, o.SALESREP_ID,
-             d.DocSubTypeSO,
-             o.DELIVERY_LOCATION_ID -- Added by Rafa Roda to include delivery location
-           ORDER BY o.PriorityRule,o.DocumentNo
-          ) LOOP
-          v_DocumentNo:='';
-          v_order_count := v_order_count +1;
-          DBMS_OUTPUT.PUT_LINE('Order ' || Cur_Order.DocumentNo || '/' || Cur_Order.C_Order_ID || ', Wh=' || Cur_Order.M_Warehouse_ID || ', Force=' || p_ForceDelivery || ', Delivery=' || Cur_Order.DeliveryRule) ;
-          -- Delivery Rules
-          --  (A)vailability
-          --  Complete (L)ine
-          --  Complete (O)rder
-          --  After (R)eceipt
-          -- (A)vailability (L)ine   -- Do we have something to ship ?
-          IF(Cur_Order.DeliveryRule IN('A', 'L', 'R', 'O')) THEN
-            v_ResultStr:='CheckSomethingToShip';
-            OPEN Cur_OrderLine(Cur_Order.C_Order_ID, Cur_Order.M_Warehouse_ID) ;
-            Cur_OrderLine_ISOPEN:=true;
-            v_ResultStr:='Fetching';
-            FETCH Cur_OrderLine INTO ol;
-            IF(Cur_OrderLine%NOTFOUND) THEN
-              DBMS_OUTPUT.PUT_LINE('  -no lines-') ;
-              Next_Order:=true;
+        ORDER BY o.PriorityRule,o.DocumentNo
+    ) LOOP
+      v_DocumentNo:='';
+      v_order_count := v_order_count +1;
+      DBMS_OUTPUT.PUT_LINE('Order ' || Cur_Order.DocumentNo || '/' || Cur_Order.C_Order_ID || ', Wh=' || Cur_Order.M_Warehouse_ID || ', Force=' || p_ForceDelivery || ', Delivery=' || Cur_Order.DeliveryRule) ;
+      -- Delivery Rules
+      --  (A)vailability
+      --  Complete (L)ine
+      --  Complete (O)rder
+      --  After (R)eceipt
+      -- (A)vailability (L)ine   -- Do we have something to ship ?
+      IF (Cur_Order.DeliveryRule IN('A', 'L', 'R', 'O')) THEN
+        v_ResultStr:='CheckSomethingToShip';
+        OPEN Cur_OrderLine(Cur_Order.C_Order_ID, Cur_Order.M_Warehouse_ID) ;
+        Cur_OrderLine_ISOPEN:=true;
+        v_ResultStr:='Fetching';
+        FETCH Cur_OrderLine INTO ol;
+        IF(Cur_OrderLine%NOTFOUND) THEN
+          DBMS_OUTPUT.PUT_LINE('  -no lines-') ;
+          Next_Order:=true;
+        END IF;
+      ELSE
+        DBMS_OUTPUT.PUT_LINE('** DeliveryRule=' || Cur_Order.DeliveryRule || ' not implemented') ;
+        Next_Order:=true;
+      END IF;
+
+      IF(NOT Next_Order) THEN
+        /**
+        * Create Order Header
+        *  if forced or if there is a line to ship
+        */
+        v_ResultStr:='CreateInOut-S';
+        v_lines:=10;
+        v_lines_per_orderline := 0;
+        --
+        Ad_Sequence_Next('M_InOut', Cur_Order.C_Order_ID, p_InOut_ID) ;
+        v_ResultStr:='CreateInOut DocType=' || Cur_Order.C_DocType_ID;
+        -- Get Shipment Doc Number
+        SELECT C_DocTypeShipment_ID INTO v_DocType_ID
+        FROM C_DOCTYPE
+        WHERE C_DocType_ID=Cur_Order.C_DocType_ID;
+        Ad_Sequence_Doctype(v_DocType_ID, Cur_Order.C_Order_ID, 'Y', v_DocumentNo) ;
+        IF (v_DocumentNo IS NULL) THEN
+          Ad_Sequence_Doc('DocumentNo_M_InOut', Cur_Order.AD_Client_ID, 'Y', v_DocumentNo) ;
+        END IF;
+
+        IF (Cur_Order.DocSubTypeSO = 'WR') THEN
+          v_NEWORDERDATE := Cur_Order.DATEORDERED; -- IS A POS ORDER
+        ELSE
+          v_NEWORDERDATE := TRUNC(now());
+        END IF;
+
+        --RAISE_APPLICATION_ERROR(-20100,'el numero documento es:'||COALESCE(v_DocumentNo,0)||' El doctypeId es: '||COALESCE(v_DocType_ID,0)||' El cOrderId es: '||COALESCE(Cur_Order.C_Order_ID,'0'));
+        --
+        DBMS_OUTPUT.PUT_LINE('  InOut_ID=' || p_InOut_ID || ', DocumentNo=' || v_DocumentNo || ', Ship_DocType_ID=' || v_DocType_ID || ', Order_DocType_ID=' || Cur_Order.C_DocType_ID) ;
+        v_ResultStr:='InsertInOut ' || p_InOut_ID;
+        INSERT INTO M_INOUT (
+            M_InOut_ID, C_Order_ID, IsSOTrx, AD_Client_ID,
+            AD_Org_ID, IsActive, Created, CreatedBy,
+            Updated, UpdatedBy, DocumentNo, C_DocType_ID,
+            Description, IsPrinted, MovementType, MovementDate,
+            DateAcct, C_BPartner_ID, C_BPartner_Location_ID, AD_User_ID,
+            M_Warehouse_ID, POReference, DateOrdered, DeliveryRule,
+            FreightCostRule, FreightAmt, C_Project_ID, C_Activity_ID,
+            C_Campaign_ID, AD_OrgTrx_ID, User1_ID, User2_ID,
+            DeliveryViaRule, M_Shipper_ID, C_Charge_ID, ChargeAmt,
+            PriorityRule, DocStatus, DocAction, Processing,
+            Processed, SALESREP_ID,
+            DELIVERY_LOCATION_ID -- Added by Rafa Roda to include delivery location
+        ) VALUES (
+            p_InOut_ID, Cur_Order.C_Order_ID, Cur_Order.IsSOTrx, Cur_Order.AD_Client_ID,
+            Cur_Order.AD_Org_ID, 'Y', now(), v_User_ID,
+            now(), v_User_ID, v_DocumentNo, v_DocType_ID,
+            Cur_Order.Description, 'N', 'C-', v_NEWORDERDATE,
+            TRUNC(now()), Cur_Order.C_BPartner_ID, Cur_Order.C_BPartner_Location_ID, Cur_Order.AD_User_ID,
+            Cur_Order.M_Warehouse_ID, Cur_Order.POReference, Cur_Order.DateOrdered, Cur_Order.DeliveryRule,
+            Cur_Order.FreightCostRule, Cur_Order.FreightAmt, Cur_Order.C_Project_ID, Cur_Order.C_Activity_ID,
+            Cur_Order.C_Campaign_ID, Cur_Order.AD_OrgTrx_ID, Cur_Order.User1_ID, Cur_Order.User2_ID,
+            Cur_Order.DeliveryViaRule, Cur_Order.M_Shipper_ID, Cur_Order.C_Charge_ID, Cur_Order.ChargeAmt,
+            Cur_Order.PriorityRule, 'DR', 'CO', 'N',
+            'N', Cur_Order.SALESREP_ID,
+            Cur_Order.DELIVERY_LOCATION_ID -- Added by Rafa Roda to include delivery location
+        );
+
+        /**
+        * Create InOut Lines
+        * for all qualifying order lines
+        */
+        DECLARE
+          v_Product_old varchar2(32);
+          v_Warehouse_old varchar2(32);
+          v_UOM_old varchar2(32);
+          v_Attribute_old varchar2(32);
+          v_Product_UOM_old varchar2(32);
+          v_orderline_old varchar2(32);
+          v_QtyStorage NUMBER:=0;
+          v_LocatorQty NUMBER;
+          v_Locator_ID VARCHAR2(32) ;
+          v_IsStocked NUMBER:=0;
+          v_pinstance_ID VARCHAR2(32);
+        BEGIN
+          LOOP
+            -- Check Availability
+            v_Qty:=ol.QtyOrdered - ol.QtyDelivered;
+            --MODIFIED BY F.IRIAZABAL
+            v_QtyOrder:=0;
+            IF (ol.M_Product_UOM_ID IS NOT NULL) THEN
+              SELECT M_PRODUCT_UOM.C_UOM_ID, C_UOM.stdprecision
+                INTO v_ProductUOM, v_stdPrecision
+              FROM M_PRODUCT_UOM, C_UOM
+              WHERE M_PRODUCT_UOM.C_UOM_ID=C_UOM.C_UOM_ID
+                AND M_Product_UOM_ID=ol.M_Product_UOM_ID;
+              IF (ol.QtyDelivered = 0) THEN
+                v_QtyOrder:=ol.QuantityOrder;
+              ELSIF (v_ProductUOM IS NOT NULL) THEN
+                v_QtyOrder:=ol.QuantityOrder*v_Qty/ol.QtyOrdered;
+                --v_QtyOrder:=C_Uom_Convert(v_Qty, ol.C_UOM_ID, v_ProductUOM, 'Y') ;
+              ELSE
+                v_QtyOrder:=NULL;
+              END IF;
+            ELSE
+              v_QtyOrder:=NULL;
             END IF;
-          ELSE
-            DBMS_OUTPUT.PUT_LINE('** DeliveryRule=' || Cur_Order.DeliveryRule || ' not implemented') ;
-            Next_Order:=true;
-          END IF;
+            -- Skip zero product lines (comments are zero qty)
+            IF (v_Qty=0 AND ol.M_Product_ID IS NOT NULL) THEN
+              Next_Line:=true;
+            END IF;
+            IF (NOT Next_Line) THEN
+              -- Is it a standard stocked product?
+              v_isstocked := 0;
+              IF (ol.M_Product_ID IS NOT NULL) THEN
+                SELECT COUNT(*) INTO v_IsStocked
+                FROM M_PRODUCT
+                WHERE M_Product_ID=ol.M_Product_ID
+                  AND IsStocked='Y'
+                  AND ProductType='I';
+              END IF;
+              -- Item is stocked - check availability
+              IF (v_IsStocked <> 0) THEN
+                -- check every locator availability and if qty available
+                --  create InOut line, update storage reservation + qty
+                v_Product_old := ol.M_Product_ID;
+                v_Warehouse_old := ol.M_Warehouse_ID;
+                v_UOM_old := ol.C_UOM_ID;
+                v_Attribute_old := ol.M_AttributeSetInstance_ID;
+                v_Product_UOM_old := ol.M_Product_UOM_ID;
+                v_orderline_old := ol.c_orderline_id;
+                IF (Cur_Storage_ISOPEN) THEN
+                  CLOSE Cur_Storage;
+                  Cur_Storage_ISOPEN:=false;
+                END IF;
+                
+                -- Call M_GET_STOCK
+                DECLARE
+                  v_pinstance_result AD_PInstance.result%TYPE;
+                  v_pinstance_msg AD_PInstance.errormsg%TYPE;
+                  v_warehouse_rule_id VARCHAR2(32);
+                BEGIN
+                  v_pinstance_id := get_uuid();
+                  INSERT INTO ad_pinstance (
+                      ad_pinstance_id, ad_process_id, record_id, isactive, 
+                      ad_user_id, ad_client_id, ad_org_id, created, createdby,
+                      updated, updatedby
+                  ) VALUES (
+                      v_pinstance_id, 'FF80818132C964E30132C9747257002E', v_record_id, 'Y',
+                      v_User_ID, v_ad_client_id, ol.AD_Org_ID, now(), v_User_ID,
+                      now(), v_User_ID
+                  );
+    
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '10', 'AD_Client_ID', v_ad_client_id, null, null, null, null, null);
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '20', 'AD_Org_ID', Cur_Order.AD_Org_ID, null, null, null, null, null);
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '30', 'M_Product_ID', v_Product_old, null, null, null, null, null);
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '40', 'C_Uom_ID', v_UOM_old, null, null, null, null, null);
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '50', 'M_Product_Uom_ID', v_Product_UOM_old, null, null, null, null, null);
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '60', 'Priority_Warehouse_ID', v_Warehouse_old, null, null, null, null, null);
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '70', 'M_AttributesetInstance_ID', v_Attribute_old, null, null, null, null, null);
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '80', 'Quantity', null, null, v_Qty, null, null, null);
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '90', 'ProcessID', '118', null, null, null, null, null);
 
-          IF(NOT Next_Order) THEN
-            /**
-            * Create Order Header
-            *  if forced or if there is a line to ship
-            */
-            v_ResultStr:='CreateInOut-S';
-            v_lines:=10;
-            v_lines_per_orderline := 0;
-            --
-            Ad_Sequence_Next('M_InOut', Cur_Order.C_Order_ID, p_InOut_ID) ;
-            v_ResultStr:='CreateInOut DocType=' || Cur_Order.C_DocType_ID;
-            -- Get Shipment Doc Number
-            SELECT C_DocTypeShipment_ID INTO v_DocType_ID
-            FROM C_DOCTYPE
-            WHERE C_DocType_ID=Cur_Order.C_DocType_ID;
-            Ad_Sequence_Doctype(v_DocType_ID, Cur_Order.C_Order_ID, 'Y', v_DocumentNo) ;
-            IF(v_DocumentNo IS NULL) THEN
-              Ad_Sequence_Doc('DocumentNo_M_InOut', Cur_Order.AD_Client_ID, 'Y', v_DocumentNo) ;
-            END IF;
+                  SELECT m_warehouse_rule_id INTO v_warehouse_rule_id
+                  FROM c_orderline
+                  WHERE c_orderline_id = ol.c_orderline_id;
+                  AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '100', 'M_Warehouse_Rule_ID', v_warehouse_rule_id, null, null, null, null, null);
 
-            IF Cur_Order.DocSubTypeSO = 'WR' THEN
-              v_NEWORDERDATE := Cur_Order.DATEORDERED; -- IS A POS ORDER
-            ELSE
-              v_NEWORDERDATE := TRUNC(now());
-            END IF;
-
-            --RAISE_APPLICATION_ERROR(-20100,'el numero documento es:'||COALESCE(v_DocumentNo,0)||' El doctypeId es: '||COALESCE(v_DocType_ID,0)||' El cOrderId es: '||COALESCE(Cur_Order.C_Order_ID,'0'));
-            --
-            DBMS_OUTPUT.PUT_LINE('  InOut_ID=' || p_InOut_ID || ', DocumentNo=' || v_DocumentNo || ', Ship_DocType_ID=' || v_DocType_ID || ', Order_DocType_ID=' || Cur_Order.C_DocType_ID) ;
-            v_ResultStr:='InsertInOut ' || p_InOut_ID;
-            INSERT INTO M_INOUT
-              (M_InOut_ID, C_Order_ID, IsSOTrx, AD_Client_ID,
-              AD_Org_ID, IsActive, Created, CreatedBy,
-              Updated, UpdatedBy, DocumentNo, C_DocType_ID,
-              Description, IsPrinted, MovementType, MovementDate,
-              DateAcct, C_BPartner_ID, C_BPartner_Location_ID, AD_User_ID,
-              M_Warehouse_ID, POReference, DateOrdered, DeliveryRule,
-              FreightCostRule, FreightAmt, C_Project_ID, C_Activity_ID,
-              C_Campaign_ID, AD_OrgTrx_ID, User1_ID, User2_ID,
-              DeliveryViaRule, M_Shipper_ID, C_Charge_ID, ChargeAmt,
-              PriorityRule, DocStatus, DocAction, Processing,
-              Processed, SALESREP_ID,
-              DELIVERY_LOCATION_ID) -- Added by Rafa Roda to include delivery location
-            VALUES
-              (p_InOut_ID, Cur_Order.C_Order_ID, Cur_Order.IsSOTrx, Cur_Order.AD_Client_ID,
-              Cur_Order.AD_Org_ID, 'Y', now(), v_User_ID,
-              now(), v_User_ID, v_DocumentNo, v_DocType_ID,
-              Cur_Order.Description, 'N', 'C-', v_NEWORDERDATE,
-              TRUNC(now()), Cur_Order.C_BPartner_ID, Cur_Order.C_BPartner_Location_ID, Cur_Order.AD_User_ID,
-              Cur_Order.M_Warehouse_ID, Cur_Order.POReference, Cur_Order.DateOrdered, Cur_Order.DeliveryRule,
-              Cur_Order.FreightCostRule, Cur_Order.FreightAmt, Cur_Order.C_Project_ID, Cur_Order.C_Activity_ID,
-              Cur_Order.C_Campaign_ID, Cur_Order.AD_OrgTrx_ID, Cur_Order.User1_ID, Cur_Order.User2_ID,
-              Cur_Order.DeliveryViaRule, Cur_Order.M_Shipper_ID, Cur_Order.C_Charge_ID, Cur_Order.ChargeAmt,
-              Cur_Order.PriorityRule, 'DR', 'CO', 'N',
-              'N', Cur_Order.SALESREP_ID,
-              Cur_Order.DELIVERY_LOCATION_ID); -- Added by Rafa Roda to include delivery location
-          END IF;--Next_Order
-          IF(NOT Next_Order) THEN
-            /**
-            * Create InOut Lines
-            * for all qualifying order lines
-            */
-            DECLARE
-              v_Product_old varchar2(32);
-              v_Warehouse_old varchar2(32);
-              v_UOM_old varchar2(32);
-              v_Attribute_old varchar2(32);
-              v_Product_UOM_old varchar2(32);
-              v_QtyStorage NUMBER:=0;
-            BEGIN
-              LOOP
-                -- Check Availability
-                v_Qty:=ol.QtyOrdered - ol.QtyDelivered;
-                --MODIFIED BY F.IRIAZABAL
-                v_QtyOrder:=0;
-                IF(ol.M_Product_UOM_ID IS NOT NULL) THEN
-                  SELECT M_PRODUCT_UOM.C_UOM_ID, C_UOM.stdprecision
-                  INTO v_ProductUOM, v_stdPrecision
-                  FROM M_PRODUCT_UOM, C_UOM
-                  WHERE M_PRODUCT_UOM.C_UOM_ID=C_UOM.C_UOM_ID
-                    AND M_Product_UOM_ID=ol.M_Product_UOM_ID;
-                  IF(ol.QtyDelivered=0) THEN
-                    v_QtyOrder:=ol.QuantityOrder;
-                  ELSIF(v_ProductUOM IS NOT NULL) THEN
-                    v_QtyOrder:=ROUND(ol.QuantityOrder*v_Qty/ol.QtyOrdered,v_stdPrecision);
-                    --v_QtyOrder:=C_Uom_Convert(v_Qty, ol.C_UOM_ID, v_ProductUOM, 'Y') ;
-                  ELSE
-                    v_QtyOrder:=NULL;
+                  M_GET_STOCK(v_pinstance_ID, 'N');
+                  -- Check result
+                  SELECT result, errormsg
+                    INTO v_pinstance_result, v_pinstance_msg
+                  FROM ad_pinstance
+                  WHERE ad_pinstance_id = v_pinstance_id;
+                  IF (v_pinstance_result = 0) THEN
+                    -- Error on m_get_stock
+                    RAISE_APPLICATION_ERROR(-20000, v_pinstance_msg);
                   END IF;
-                ELSE
-                  v_QtyOrder:=NULL;
+                END; -- End Call M_GET_STOCK
+                
+                OPEN Cur_Storage(v_pinstance_id) ;
+                Cur_Storage_ISOPEN:=true;
+                FETCH Cur_Storage INTO v_storage;
+                IF (Cur_Storage%NOTFOUND) THEN
+                  NEXT_PRODUCT:=true;
+                  CLOSE Cur_Storage;
+                  Cur_Storage_ISOPEN:=false;
                 END IF;
-                -- Skip zero product lines (comments are zero qty)
-                IF(v_Qty=0 AND ol.M_Product_ID IS NOT NULL) THEN
-                  Next_Line:=true;
-                END IF;
-                IF(NOT Next_Line) THEN
-                  --
-                  DECLARE
-                    v_LocatorQty NUMBER;
-                    v_Locator_ID VARCHAR2(32) ;
-                    v_IsStocked NUMBER:=0;
-                  BEGIN
-                    -- Is it a standard stocked product?
-                    IF(ol.M_Product_ID IS NOT NULL) THEN
-                      SELECT COUNT(*) INTO v_IsStocked
-                      FROM M_PRODUCT
-                      WHERE M_Product_ID=ol.M_Product_ID
-                        AND IsStocked='Y'
-                        AND ProductType='I';
+                IF (NOT NEXT_PRODUCT) THEN
+                  v_QtyStorage:=v_storage.QtyOnHand;
+                  LOOP
+                    -- How much do we deliver from here?
+                    v_ResultStr:='Deliver';
+                    IF (v_Qty > v_QtyStorage) THEN
+                      v_LocatorQty:=v_QtyStorage;
+                    ELSE
+                      v_LocatorQty:=v_Qty;
+                      v_QtyStorage:=v_QtyStorage-v_Qty;
                     END IF;
-                    -- Item is stocked - check availability
-                    IF(v_IsStocked<>0) THEN
-                      -- check every locator availability and if qty available
-                      --  create InOut line, update storage reservation + qty
-                      IF(NOT Cur_Storage_ISOPEN)
-                        OR(v_Product_old<>ol.M_Product_ID
-                           OR v_Warehouse_old<>ol.M_Warehouse_ID
-                           OR v_UOM_old<>ol.C_UOM_ID
-                           OR COALESCE(v_Attribute_old, '0')<>COALESCE(ol.M_AttributeSetInstance_ID, '0')
-                           OR COALESCE(v_Product_UOM_old, '0')<>COALESCE(ol.M_Product_UOM_ID, '0')) THEN
-                        v_Product_old:=ol.M_Product_ID;
-                        v_Warehouse_old:=ol.M_Warehouse_ID;
-                        v_UOM_old:=ol.C_UOM_ID;
-                        v_Attribute_old:=ol.M_AttributeSetInstance_ID;
-                        v_Product_UOM_old:=ol.M_Product_UOM_ID;
-                        IF(Cur_Storage_ISOPEN) THEN
-                          CLOSE Cur_Storage;
-                          Cur_Storage_ISOPEN:=false;
-                        END IF;
-                        OPEN Cur_Storage(v_Product_old, v_Warehouse_old, v_UOM_old, v_Product_UOM_old, v_Attribute_old) ;
-                        Cur_Storage_ISOPEN:=true;
-                        FETCH Cur_Storage INTO v_storage;
-                        IF Cur_Storage%NOTFOUND THEN
-                          NEXT_PRODUCT:=true;
-                          CLOSE Cur_Storage;
-                          Cur_Storage_ISOPEN:=false;
-                        END IF;
-                        IF(NOT NEXT_PRODUCT) THEN
-                          v_QtyStorage:=v_storage.QtyOnHand;
-                        END IF;--NEXT_PRODUCT
-                      END IF;
-                      IF(NOT NEXT_PRODUCT) THEN
-                        LOOP
-                          -- How much do we deliver from here?
-                          v_ResultStr:='Deliver';
-                          IF(v_Qty>v_QtyStorage) THEN
-                            v_LocatorQty:=v_QtyStorage;
-                          ELSE
-                            v_LocatorQty:=v_Qty;
-                            v_QtyStorage:=v_QtyStorage-v_Qty;
-                          END IF;
-                          v_ActualQty:=NULL;
-                          IF v_storage.M_Product_UOM_ID IS NOT NULL THEN
-                            v_ActualQty:=v_storage.QtyOrder*(v_LocatorQty/v_storage.QtyOnHand) ;
-                          END IF;
-                          IF(v_LocatorQty<>0) THEN
-                            -- Create InOut Line
-                            Ad_Sequence_Next('M_InOutLine', Cur_Order.C_Order_ID, v_NextNo) ;
-                            --
-                            DBMS_OUTPUT.PUT_LINE('    Line ' || ol.Line || '  Qty=' || v_LocatorQty) ;
-                            v_ResultStr:='CreateInOutLine';
-                            INSERT INTO M_INOUTLINE
-                              (M_InOutLine_ID, Line, M_InOut_ID, C_OrderLine_ID,
-                              AD_Client_ID, AD_Org_ID, IsActive, Created,
-                              CreatedBy, Updated, UpdatedBy, M_Product_ID,
-                              C_UOM_ID, M_Locator_ID, MovementQty, Description,
-                              IsInvoiced,
-                              --MODIFIED BY F.IRIAZABAL
-                              QuantityOrder, M_Product_Uom_ID, M_AttributeSetInstance_ID)
-                            VALUES
-                              (v_NextNo, v_lines, p_InOut_ID, ol.C_OrderLine_ID,
-                              ol.AD_Client_ID, ol.AD_Org_ID, 'Y', now(),
-                              v_User_ID, now(), v_User_ID, ol.M_Product_ID,
-                              v_storage.C_UOM_ID, v_storage.M_Locator_ID, v_LocatorQty, ol.Description,
-                              'N',
-                              --MODIFIED BY F.IRIAZABAL
-                              v_ActualQty, v_storage.M_PRODUCT_UOM_ID, v_storage.M_AttributeSetInstance_ID);
-                            v_lines:=v_lines + 10;
-                            v_lines_per_orderline:= v_lines_per_orderline + 10;
-                            DBMS_OUTPUT.PUT_LINE('v_lines' || v_lines) ;
-                          END IF;
-                          v_Qty:=v_Qty - v_LocatorQty;
-                          --MODIFIED BY F.IRIAZABAL
-                          v_QtyOrder:=v_QtyOrder - v_ActualQty;
-                          EXIT WHEN v_Qty=0;
-                          v_QtyStorage:=0;
-                          v_ResultStr:='FetchingData';
-                          FETCH Cur_Storage INTO v_storage;
-                          EXIT WHEN Cur_Storage%NOTFOUND;
-                          v_QtyStorage:=v_storage.QtyOnHand;
-                        END LOOP; -- Storage
-                      END IF;--NEXT_PRODUCT
-                      --<<NEXT_PRODUCT>>
-                      NEXT_PRODUCT:=false;
-                      IF(v_Qty<>0 AND (p_ForceDelivery='Y' OR v_allownegativestock = 'Y')) THEN
-                        -- Create InOut Line
-                        Ad_Sequence_Next('M_InOutLine', Cur_Order.C_Order_ID, v_NextNo) ;
-                        IF(v_ProductUOM IS NOT NULL) THEN
-                          v_ActualQty:=ol.QuantityOrder*v_Qty/ol.QtyOrdered;
-                          --v_ActualQty:=C_Uom_Convert(v_Qty, ol.C_UOM_ID, v_ProductUOM, 'Y') ;
-                        ELSE
-                          v_ActualQty:=NULL;
-                        END IF;
-                        SELECT MIN(M_LOCATOR_ID) INTO v_Locator_ID
-                        FROM M_LOCATOR
-                        WHERE M_WAREHOUSE_ID=ol.M_Warehouse_ID
-                        AND M_LOCATOR.ISACTIVE = 'Y';
-                        --
-                        DBMS_OUTPUT.PUT_LINE('    Line ' || ol.Line || '  Qty=' || v_LocatorQty) ;
-                        v_ResultStr:='CreateInOutLine';
-                        INSERT INTO M_INOUTLINE
-                          (M_InOutLine_ID, Line, M_InOut_ID, C_OrderLine_ID,
-                          AD_Client_ID, AD_Org_ID, IsActive, Created,
-                          CreatedBy, Updated, UpdatedBy, M_Product_ID,
-                          C_UOM_ID, M_Locator_ID, MovementQty, Description,
-                          IsInvoiced,
-                          --MODIFIED BY F.IRIAZABAL   ,
-                          QuantityOrder, M_Product_Uom_ID, M_AttributeSetInstance_ID)
-                        VALUES
-                          (v_NextNo, v_lines, p_InOut_ID, ol.C_OrderLine_ID,
-                          ol.AD_Client_ID, ol.AD_Org_ID, 'Y', now(),
-                          v_User_ID, now(), v_User_ID, ol.M_Product_ID,
-                          ol.C_UOM_ID, v_Locator_ID, v_Qty, ol.Description,
-                          'N',
-                          --MODIFIED BY F.IRIAZABAL
-                          v_ActualQty, ol.M_PRODUCT_UOM_ID, ol.M_AttributeSetInstance_ID);
-                        v_lines:=v_lines + 10;
-                      ELSIF (v_qty <> 0) THEN
-                        IF (cur_order.deliveryrule = 'O') THEN
-                          DBMS_OUTPUT.PUT_LINE('Not enough stocked products, delivery type Order');
-                          next_order := true;
-                          v_lines := 0;
-                          EXIT;
-                        ELSIF (Cur_order.deliveryrule = 'L') THEN
-                          DBMS_OUTPUT.PUT_LINE('Not enough stocked products, delivery type Line');
-                          v_lines := v_lines - v_lines_per_orderline;
-                          IF (LENGTH(v_resultlinesstr || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockDeliveryRuleLine@.') <= 1800 ) THEN
-			    v_resultlinesstr := COALESCE(v_resultlinesstr, '') || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockDeliveryRuleLine@.' ;
-			  END IF;
-                          v_hasPartial := true;
-                          DELETE FROM M_INOUTLINE
-                          WHERE M_INOUT_ID = p_InOut_ID
-                            AND C_ORDERLINE_ID = ol.C_ORDERLINE_ID;
-                        ELSE
-                          IF (v_lines <= 10) THEN
-                            IF (LENGTH(v_resultlinesstr || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockPartial@' || '.') <= 1800 ) THEN
-                              v_resultlinesstr := COALESCE(v_resultlinesstr, '') || '<br>@OrderLine@: ' || ol.Line || ' @NotEnoughStocked@ @ForProduct@ ' || ol.name || '.' ;
-                            END IF;
-                          ELSE
-                            IF (LENGTH(v_resultlinesstr || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockPartial@' || '.') <= 1800 ) THEN
-                              v_resultlinesstr := COALESCE(v_resultlinesstr, '') || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockPartial@' || '.' ;
-                            END IF;
-                          END IF;
-                          v_hasPartial := true;
-                        END IF;
-                      END IF;
-                      -- Copy Ad-hoc lines, Comments OR Service Items
-                    ELSE
+                    v_ActualQty:=NULL;
+                    IF (v_storage.M_Product_UOM_ID IS NOT NULL) THEN
+                      v_ActualQty:=ROUND(v_storage.QtyOrder*(v_LocatorQty/v_storage.QtyOnHand), v_storage.stdprecision) ;
+                    END IF;
+                    IF (v_LocatorQty <> 0) THEN
                       -- Create InOut Line
                       Ad_Sequence_Next('M_InOutLine', Cur_Order.C_Order_ID, v_NextNo) ;
                       --
-                      DBMS_OUTPUT.PUT_LINE('    Line* ' || ol.Line || '  Qty=' || v_Qty) ;
-                      v_ResultStr:='CreateInOutLine*2 '||ol.c_order_id||'-'||ol.line||'-'||ol.m_product_id;
+                      DBMS_OUTPUT.PUT_LINE('    Line ' || ol.Line || '  Qty=' || v_LocatorQty) ;
+                      v_ResultStr:='CreateInOutLine';
                       INSERT INTO M_INOUTLINE
                         (M_InOutLine_ID, Line, M_InOut_ID, C_OrderLine_ID,
                         AD_Client_ID, AD_Org_ID, IsActive, Created,
@@ -565,284 +485,381 @@
                         (v_NextNo, v_lines, p_InOut_ID, ol.C_OrderLine_ID,
                         ol.AD_Client_ID, ol.AD_Org_ID, 'Y', now(),
                         v_User_ID, now(), v_User_ID, ol.M_Product_ID,
-                        ol.C_UOM_ID, NULL, v_Qty, ol.Description,
+                        v_storage.C_UOM_ID, v_storage.M_Locator_ID, v_LocatorQty, ol.Description,
                         'N',
                         --MODIFIED BY F.IRIAZABAL
-                        v_QtyOrder, ol.M_PRODUCT_UOM_ID, ol.M_ATTRIBUTESETINSTANCE_ID);
+                        v_ActualQty, v_storage.M_PRODUCT_UOM_ID, v_storage.M_AttributeSetInstance_ID);
                       v_lines:=v_lines + 10;
+                      v_lines_per_orderline:= v_lines_per_orderline + 10;
+                      DBMS_OUTPUT.PUT_LINE('v_lines' || v_lines) ;
                     END IF;
-                  END;
-                END IF;--Next_Line
-                --<<Next_Line>>
-                Next_Line:=false;
-                FETCH Cur_OrderLine INTO ol;
-                v_lines_per_orderline := 0;
-                EXIT WHEN Cur_OrderLine%NOTFOUND;
-              END LOOP; -- Order Line Loop
-            END;--END DECLARE VARIABLES FOR ORDER LINE LOOP
-          END IF;--Next_Order
-          -- Validate result message for user
-          IF (v_lines <= 10) THEN
-              DELETE FROM M_INOUTLINE
-              WHERE M_INOUT_ID  = p_InOut_ID;
-              DELETE FROM M_INOUT
-              WHERE M_INOUT_ID = p_InOut_ID;
-              next_order := TRUE;
-              IF (Cur_Order.DeliveryRule='O') THEN
-                result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ': ' || '@ShipmentError@. @notEnoughStockDeliveryRuleOrder@.';
+                    v_Qty:=v_Qty - v_LocatorQty;
+                    --MODIFIED BY F.IRIAZABAL
+                    v_QtyOrder:=v_QtyOrder - v_ActualQty;
+                    EXIT WHEN v_Qty=0;
+                    v_QtyStorage:=0;
+                    v_ResultStr:='FetchingData';
+                    FETCH Cur_Storage INTO v_storage;
+                    EXIT WHEN Cur_Storage%NOTFOUND;
+                    v_QtyStorage:=v_storage.QtyOnHand;
+                  END LOOP; -- Storage
+                END IF;--NEXT_PRODUCT
+                --<<NEXT_PRODUCT>>
+                NEXT_PRODUCT:=false;
+                IF (v_Qty<>0 AND (p_ForceDelivery='Y' OR v_allownegativestock = 'Y')) THEN
+                  -- Create InOut Line
+                  Ad_Sequence_Next('M_InOutLine', Cur_Order.C_Order_ID, v_NextNo) ;
+                  IF (v_ProductUOM IS NOT NULL) THEN
+                    v_ActualQty:=ol.QuantityOrder*v_Qty/ol.QtyOrdered;
+                    --v_ActualQty:=C_Uom_Convert(v_Qty, ol.C_UOM_ID, v_ProductUOM, 'Y') ;
+                  ELSE
+                    v_ActualQty:=NULL;
+                  END IF;
+                  SELECT MIN(M_LOCATOR_ID) INTO v_Locator_ID
+                  FROM M_LOCATOR
+                  WHERE M_WAREHOUSE_ID=ol.M_Warehouse_ID
+                  AND M_LOCATOR.ISACTIVE = 'Y';
+                  --
+                  DBMS_OUTPUT.PUT_LINE('    Line ' || ol.Line || '  Qty=' || v_LocatorQty) ;
+                  v_ResultStr:='CreateInOutLine';
+                  INSERT INTO M_INOUTLINE
+                    (M_InOutLine_ID, Line, M_InOut_ID, C_OrderLine_ID,
+                    AD_Client_ID, AD_Org_ID, IsActive, Created,
+                    CreatedBy, Updated, UpdatedBy, M_Product_ID,
+                    C_UOM_ID, M_Locator_ID, MovementQty, Description,
+                    IsInvoiced,
+                    --MODIFIED BY F.IRIAZABAL   ,
+                    QuantityOrder, M_Product_Uom_ID, M_AttributeSetInstance_ID)
+                  VALUES
+                    (v_NextNo, v_lines, p_InOut_ID, ol.C_OrderLine_ID,
+                    ol.AD_Client_ID, ol.AD_Org_ID, 'Y', now(),
+                    v_User_ID, now(), v_User_ID, ol.M_Product_ID,
+                    ol.C_UOM_ID, v_Locator_ID, v_Qty, ol.Description,
+                    'N',
+                    --MODIFIED BY F.IRIAZABAL
+                    v_ActualQty, ol.M_PRODUCT_UOM_ID, ol.M_AttributeSetInstance_ID);
+                  v_lines:=v_lines + 10;
+                ELSIF (v_qty <> 0) THEN
+                  IF (cur_order.deliveryrule = 'O') THEN
+                    DBMS_OUTPUT.PUT_LINE('Not enough stocked products, delivery type Order');
+                    next_order := true;
+                    v_lines := 0;
+                    EXIT;
+                  ELSIF (Cur_order.deliveryrule = 'L') THEN
+                    DBMS_OUTPUT.PUT_LINE('Not enough stocked products, delivery type Line');
+                    v_lines := v_lines - v_lines_per_orderline;
+                    IF (LENGTH(v_resultlinesstr || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockDeliveryRuleLine@.') <= 1800 ) THEN
+                      v_resultlinesstr := COALESCE(v_resultlinesstr, '') || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockDeliveryRuleLine@.' ;
+                    END IF;
+                    v_hasPartial := true;
+                    DELETE FROM M_INOUTLINE
+                    WHERE M_INOUT_ID = p_InOut_ID
+                      AND C_ORDERLINE_ID = ol.C_ORDERLINE_ID;
+                  ELSE
+                    IF (v_lines <= 10) THEN
+                      IF (LENGTH(v_resultlinesstr || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockPartial@' || '.') <= 1800 ) THEN
+                        v_resultlinesstr := COALESCE(v_resultlinesstr, '') || '<br>@OrderLine@: ' || ol.Line || ' @NotEnoughStocked@ @ForProduct@ ' || ol.name || '.' ;
+                      END IF;
+                    ELSE
+                      IF (LENGTH(v_resultlinesstr || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockPartial@' || '.') <= 1800 ) THEN
+                        v_resultlinesstr := COALESCE(v_resultlinesstr, '') || '<br>@OrderLine@: ' || ol.Line || ' @ForProduct@ ' || ol.name || ': @notEnoughStockPartial@' || '.' ;
+                      END IF;
+                    END IF;
+                    v_hasPartial := true;
+                  END IF;
+                END IF;
+                -- Copy Ad-hoc lines, Comments OR Service Items
               ELSE
-                result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ': ' || '@ShipmentError@.' || v_resultlinesstr;
+                -- Create InOut Line
+                Ad_Sequence_Next('M_InOutLine', Cur_Order.C_Order_ID, v_NextNo) ;
+                --
+                DBMS_OUTPUT.PUT_LINE('    Line* ' || ol.Line || '  Qty=' || v_Qty) ;
+                v_ResultStr:='CreateInOutLine*2 '||ol.c_order_id||'-'||ol.line||'-'||ol.m_product_id;
+                INSERT INTO M_INOUTLINE
+                  (M_InOutLine_ID, Line, M_InOut_ID, C_OrderLine_ID,
+                  AD_Client_ID, AD_Org_ID, IsActive, Created,
+                  CreatedBy, Updated, UpdatedBy, M_Product_ID,
+                  C_UOM_ID, M_Locator_ID, MovementQty, Description,
+                  IsInvoiced,
+                  --MODIFIED BY F.IRIAZABAL
+                  QuantityOrder, M_Product_Uom_ID, M_AttributeSetInstance_ID)
+                VALUES
+                  (v_NextNo, v_lines, p_InOut_ID, ol.C_OrderLine_ID,
+                  ol.AD_Client_ID, ol.AD_Org_ID, 'Y', now(),
+                  v_User_ID, now(), v_User_ID, ol.M_Product_ID,
+                  ol.C_UOM_ID, NULL, v_Qty, ol.Description,
+                  'N',
+                  --MODIFIED BY F.IRIAZABAL
+                  v_QtyOrder, ol.M_PRODUCT_UOM_ID, ol.M_ATTRIBUTESETINSTANCE_ID);
+                v_lines:=v_lines + 10;
               END IF;
-          ELSIF (v_hasPartial) THEN
-            v_order_partial_count := v_order_partial_count +1;
-            result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ' @InoutDocumentno@ ' || v_DocumentNo || ': @ShipmentPartial@.' || v_resultlinesstr;
-          ELSE
-            v_order_delivered_count := v_order_delivered_count +1;
-            result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ' @InoutDocumentno@ ' || v_DocumentNo || ': @ShipmentSuccess@.' ;
+            END IF;--Next_Line
+            --<<Next_Line>>
+            Next_Line:=false;
+            FETCH Cur_OrderLine INTO ol;
+            v_lines_per_orderline := 0;
+            EXIT WHEN Cur_OrderLine%NOTFOUND;
+          END LOOP; -- Order Line Loop
+        END;--END DECLARE VARIABLES FOR ORDER LINE LOOP
+      END IF;--Next_Order
+      -- Validate result message for user
+      IF (v_lines <= 10) THEN
+        DELETE FROM M_INOUTLINE
+        WHERE M_INOUT_ID  = p_InOut_ID;
+        DELETE FROM M_INOUT
+        WHERE M_INOUT_ID = p_InOut_ID;
+        next_order := TRUE;
+        IF (Cur_Order.DeliveryRule='O') THEN
+          result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ': ' || '@ShipmentError@. @notEnoughStockDeliveryRuleOrder@.';
+        ELSE
+          result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ': ' || '@ShipmentError@.' || v_resultlinesstr;
+        END IF;
+      ELSIF (v_hasPartial) THEN
+        v_order_partial_count := v_order_partial_count +1;
+        result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ' @InoutDocumentno@ ' || v_DocumentNo || ': @ShipmentPartial@.' || v_resultlinesstr;
+      ELSE
+        v_order_delivered_count := v_order_delivered_count +1;
+        result_String := '@OrderDocumentno@ ' || cur_order.DocumentNo || ' @InoutDocumentno@ ' || v_DocumentNo || ': @ShipmentSuccess@.' ;
+      END IF;
+      IF (LENGTH(v_Message || result_String || '<br><br>') <= 1800 ) THEN
+        v_Message:=v_Message || result_String || '<br><br>';
+        v_logLines := v_logLines + 1;
+      ELSE
+        v_isWholeLog := false;
+      END IF;
+      result_String := '';
+      v_resultlinesstr := '';
+      v_hasPartial := false;
+      IF (NOT Next_Order) THEN
+        IF (v_lines = 0) THEN
+          DELETE FROM M_INOUTLINE
+          WHERE M_INOUT_ID  = p_InOut_ID;
+          DELETE FROM M_INOUT
+          WHERE M_INOUT_ID = p_InOut_ID;
+        ELSE
+          v_PostResult := NULL;
+
+          --M_Inout_Create - Calling Post Process
+          --Extension point at the end of the M_Inout_Create. It has 4 available parameters Record_ID, DocAction, User and Result
+          SELECT count(*) INTO v_count
+          FROM DUAL
+          where exists (select 1 from ad_ep_procedures where ad_extension_points_id = '18625A6DBF3944A98E6DC375BF88C1EA');
+          IF (v_count=1) THEN
+            DECLARE
+              v_ep_instance VARCHAR2(32);
+              v_extension_point_id VARCHAR2(32) := '18625A6DBF3944A98E6DC375BF88C1EA';
+            BEGIN
+              v_ep_instance := get_uuid();
+              AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'Record_ID',
+                  p_InOut_ID, NULL, NULL, NULL, NULL, NULL, NULL);
+              AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'DocAction',
+                  'CO', NULL, NULL, NULL, NULL, NULL, NULL);
+              AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'User',
+                  v_User_ID, NULL, NULL, NULL, NULL, NULL, NULL);
+              AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'Result',
+                  NULL, NULL, v_PostResult, NULL, NULL, NULL, NULL);
+              AD_EXTENSION_POINT_HANDLER(v_ep_instance, v_extension_point_id);
+              SELECT p_number INTO v_PostResult
+              FROM ad_ep_instance_para
+              WHERE ad_ep_instance_id = v_ep_instance
+                AND parametername LIKE 'Result';
+
+              DELETE FROM ad_ep_instance_para
+              WHERE ad_ep_instance_id = v_ep_instance;
+            END;
           END IF;
-          IF (LENGTH(v_Message || result_String || '<br><br>') <= 1800 ) THEN
-		v_Message:=v_Message || result_String || '<br><br>';          
-		v_logLines := v_logLines + 1;
-	  ELSE
-		v_isWholeLog := false;
-	  END IF;
-          result_String := '';
-          v_resultlinesstr := '';
-          v_hasPartial := false;
-          IF(NOT Next_Order) THEN
-            IF(v_lines=0) THEN
-              DELETE FROM M_INOUTLINE
-              WHERE M_INOUT_ID  = p_InOut_ID;
-              DELETE FROM M_INOUT
-              WHERE M_INOUT_ID = p_InOut_ID;
-            ELSE
 
-                v_PostResult := NULL;
+          IF (v_PostResult IS NULL) THEN
+            -- Post Shipment
+            M_INOUT_POST(NULL, p_InOut_ID) ;
+          END IF;
 
-                --M_Inout_Create - Calling Post Process
-                --Extension point at the end of the M_Inout_Create. It has 4 available parameters Record_ID, DocAction, User and Result
-                SELECT count(*) INTO v_count
-                FROM DUAL
-                where exists (select 1 from ad_ep_procedures where ad_extension_points_id = '18625A6DBF3944A98E6DC375BF88C1EA');
-                IF (v_count=1) THEN
-                  DECLARE
-                    v_ep_instance VARCHAR2(32);
-                    v_extension_point_id VARCHAR2(32) := '18625A6DBF3944A98E6DC375BF88C1EA';
-                  BEGIN
-                    v_ep_instance := get_uuid();
-                    AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'Record_ID',
-                      p_InOut_ID, NULL, NULL, NULL, NULL, NULL, NULL);
-                    AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'DocAction',
-                      'CO', NULL, NULL, NULL, NULL, NULL, NULL);
-                    AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'User',
-                      v_User_ID, NULL, NULL, NULL, NULL, NULL, NULL);
-                    AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'Result',
-                      NULL, NULL, v_PostResult, NULL, NULL, NULL, NULL);
-                    AD_EXTENSION_POINT_HANDLER(v_ep_instance, v_extension_point_id);
-                    SELECT p_number INTO v_PostResult
-                    FROM ad_ep_instance_para
-                    WHERE ad_ep_instance_id = v_ep_instance
-                      AND parametername LIKE 'Result';
+        END IF;
+      END IF;--Next_Order
+      --<<Next_Order>>
+      Next_Order:=false;
+      IF (Cur_Storage_ISOPEN) THEN
+        CLOSE Cur_Storage;
+        Cur_Storage_ISOPEN:=false;
+      END IF;
+      IF (Cur_OrderLine_ISOPEN) THEN
+        CLOSE Cur_OrderLine;
+        Cur_OrderLine_ISOPEN:=false;
+      END IF;
+    END LOOP; -- Order Header Loop
+    IF (v_order_delivered_count = 0 AND v_order_partial_count = 0) THEN
+      IF (v_Message = '') THEN
+        v_Message := '@ZeroOrdersProcessed@';
+      ELSE
+        v_Message := COALESCE(v_Message, '@ZeroOrdersProcessed@');
+      END IF;
+      v_result :=0;
+    ELSIF (v_order_partial_count <> 0 OR v_order_delivered_count <> v_order_count) THEN
+      v_result :=2;
+    END IF;
+  ELSE --CREATE_FROM_INVOICE
+    /**************************************************************************
+    * Create Shipment from Invoice
+    *************************************************************************/
+    --<<CREATE_FROM_INVOICE>>
+    CREATE_FROM_INVOICE:=false;
+    DECLARE
+      Cur_Invoice RECORD;
+      Cur_Lines RECORD;
+      v_Warehouse_ID VARCHAR2(32);
+      v_IsDocNoControlled CHAR(1) ;
+    BEGIN
+      FOR Cur_Invoice IN (
+          SELECT * FROM C_INVOICE WHERE C_Invoice_ID=p_Invoice_ID
+      ) LOOP
+        v_ResultStr:='CreateInOut';
+        -- Get Warehouse from Locator
+        SELECT M_Warehouse_ID INTO v_Warehouse_ID
+        FROM M_LOCATOR
+        WHERE M_Locator_ID=p_Locator_ID;
+        -- Get Shipment Doc Number
+        v_DocType_ID:=Ad_Get_DocType(Cur_Invoice.AD_Client_ID, Cur_Invoice.AD_Org_ID, 'MMR') ;
+        SELECT IsDocNoControlled INTO v_IsDocNoControlled
+        FROM C_DOCTYPE
+        WHERE C_DocType_ID=v_DocType_ID;
+        IF (v_IsDocNoControlled='Y') THEN
+          Ad_Sequence_Doctype(v_DocType_ID, Cur_Invoice.C_Invoice_ID, 'Y', v_DocumentNo) ;
+          IF (v_DocumentNo IS NULL) THEN
+            Ad_Sequence_Doc('DocumentNo_M_InOut', Cur_Invoice.AD_Client_ID, 'Y', v_DocumentNo) ;
+          END IF;
+        ELSE
+          v_DocumentNo:=Cur_Invoice.DocumentNo;
+        END IF;
+        Ad_Sequence_Next('M_InOut', Cur_Invoice.C_Invoice_ID, p_InOut_ID) ;
+        --
+        DBMS_OUTPUT.PUT_LINE('  InOut_ID=' || p_InOut_ID || ' DocumentNo=' || v_DocumentNo) ;
+        v_ResultStr:='InsertInOut ' || p_InOut_ID;
+        INSERT INTO M_INOUT (
+          M_InOut_ID, C_Order_ID, IsSOTrx, C_Invoice_ID,
+          AD_Client_ID, AD_Org_ID, IsActive, Created,
+          CreatedBy, Updated, UpdatedBy, DocumentNo,
+          C_DocType_ID, Description, IsPrinted, MovementType,
+          MovementDate, DateAcct, C_BPartner_ID, C_BPartner_Location_ID,
+          AD_User_ID, M_Warehouse_ID, POReference, DateOrdered,
+          SalesRep_ID,
+          DeliveryRule,
+          FreightCostRule,
+          FreightAmt,
+          DeliveryViaRule, M_Shipper_ID, C_Charge_ID, ChargeAmt,
+          PriorityRule,
+          DocStatus, DocAction, Processing, Processed
+        ) VALUES (
+          p_InOut_ID, NULL, Cur_Invoice.IsSoTrx, Cur_Invoice.C_Invoice_ID,
+          Cur_Invoice.AD_Client_ID, Cur_Invoice.AD_Org_ID, 'Y', now(),
+          v_User_ID, now(), v_User_ID, v_DocumentNo,
+          v_DocType_ID, Cur_Invoice.Description, 'N', 'V+',
+          Cur_Invoice.DateInvoiced, Cur_Invoice.DateInvoiced, Cur_Invoice.C_BPartner_ID, Cur_Invoice.C_BPartner_Location_ID,
+          Cur_Invoice.AD_User_ID, v_Warehouse_ID, Cur_Invoice.POReference, Cur_Invoice.DateInvoiced,
+          Cur_Invoice.SalesRep_ID,
+          'A', -- Available
+          'I',
+          0, -- Freight included
+          'P', NULL, Cur_Invoice.C_Charge_ID, Cur_Invoice.ChargeAmt,
+          '3', -- PickUp, High Priority
+          'DR', 'CO', 'N', 'N'
+        );
 
-                    DELETE FROM ad_ep_instance_para
-                    WHERE ad_ep_instance_id = v_ep_instance;
-                  END;
-                END IF;
-
-                IF (v_PostResult IS NULL) THEN
-                  -- Post Shipment
-                  M_INOUT_POST(NULL, p_InOut_ID) ;
-                END IF;
-
-            END IF;
-          END IF;--Next_Order
-          --<<Next_Order>>
-          Next_Order:=false;
-          IF(Cur_Storage_ISOPEN) THEN
-            CLOSE Cur_Storage;
-            Cur_Storage_ISOPEN:=false;
-          END IF;
-          IF(Cur_OrderLine_ISOPEN) THEN
-            CLOSE Cur_OrderLine;
-            Cur_OrderLine_ISOPEN:=false;
-          END IF;
-        END LOOP; -- Order Header Loop
-        IF (v_order_delivered_count = 0 AND v_order_partial_count = 0) THEN
-          IF (v_Message = '') THEN
-            v_Message := '@ZeroOrdersProcessed@';
-          ELSE
-            v_Message := COALESCE(v_Message, '@ZeroOrdersProcessed@');
-          END IF;
-          v_result :=0;
-        ELSIF (v_order_partial_count <> 0 OR v_order_delivered_count <> v_order_count) THEN
-          v_result :=2;
-        END IF;
-        FINISH_PROCESS:=true;
-      END IF;--CREATE_FROM_INVOICE
-      IF(NOT FINISH_PROCESS) THEN
-        /**************************************************************************
-        * Create Shipment from Invoice
-        *************************************************************************/
-        --<<CREATE_FROM_INVOICE>>
-        CREATE_FROM_INVOICE:=false;
-        DECLARE
-          Cur_Invoice RECORD;
-          Cur_Lines RECORD;
-          v_Warehouse_ID VARCHAR2(32);
-          v_IsDocNoControlled CHAR(1) ;
-        BEGIN
-          FOR Cur_Invoice IN
-            (SELECT * FROM C_INVOICE WHERE C_Invoice_ID=p_Invoice_ID) LOOP
-            v_ResultStr:='CreateInOut';
-            -- Get Warehouse from Locator
-            SELECT M_Warehouse_ID INTO v_Warehouse_ID
-            FROM M_LOCATOR
-            WHERE M_Locator_ID=p_Locator_ID;
-            -- Get Shipment Doc Number
-            v_DocType_ID:=Ad_Get_DocType(Cur_Invoice.AD_Client_ID, Cur_Invoice.AD_Org_ID, 'MMR') ;
-            SELECT IsDocNoControlled INTO v_IsDocNoControlled
-            FROM C_DOCTYPE
-            WHERE C_DocType_ID=v_DocType_ID;
-            IF(v_IsDocNoControlled='Y') THEN
-              Ad_Sequence_Doctype(v_DocType_ID, Cur_Invoice.C_Invoice_ID, 'Y', v_DocumentNo) ;
-              IF(v_DocumentNo IS NULL) THEN
-                Ad_Sequence_Doc('DocumentNo_M_InOut', Cur_Invoice.AD_Client_ID, 'Y', v_DocumentNo) ;
-              END IF;
-            ELSE
-              v_DocumentNo:=Cur_Invoice.DocumentNo;
-            END IF;
-            Ad_Sequence_Next('M_InOut', Cur_Invoice.C_Invoice_ID, p_InOut_ID) ;
-            --
-            DBMS_OUTPUT.PUT_LINE('  InOut_ID=' || p_InOut_ID || ' DocumentNo=' || v_DocumentNo) ;
-            v_ResultStr:='InsertInOut ' || p_InOut_ID;
-            INSERT INTO M_INOUT
-              (M_InOut_ID, C_Order_ID, IsSOTrx, C_Invoice_ID,
-              AD_Client_ID, AD_Org_ID, IsActive, Created,
-              CreatedBy, Updated, UpdatedBy, DocumentNo,
-              C_DocType_ID, Description, IsPrinted, MovementType,
-              MovementDate, DateAcct, C_BPartner_ID, C_BPartner_Location_ID,
-              AD_User_ID, M_Warehouse_ID, POReference, DateOrdered,
-              SalesRep_ID,
-              DeliveryRule,
-              FreightCostRule,
-              FreightAmt,
-              DeliveryViaRule, M_Shipper_ID, C_Charge_ID, ChargeAmt,
-              PriorityRule,
-              DocStatus, DocAction, Processing, Processed
-              )
-            VALUES
-              (p_InOut_ID, NULL, Cur_Invoice.IsSoTrx, Cur_Invoice.C_Invoice_ID,
-              Cur_Invoice.AD_Client_ID, Cur_Invoice.AD_Org_ID, 'Y', now(),
-              v_User_ID, now(), v_User_ID, v_DocumentNo,
-              v_DocType_ID, Cur_Invoice.Description, 'N', 'V+',
-              Cur_Invoice.DateInvoiced, Cur_Invoice.DateInvoiced, Cur_Invoice.C_BPartner_ID, Cur_Invoice.C_BPartner_Location_ID,
-              Cur_Invoice.AD_User_ID, v_Warehouse_ID, Cur_Invoice.POReference, Cur_Invoice.DateInvoiced,
-              Cur_Invoice.SalesRep_ID,
-              'A', -- Available
-              'I',
-              0, -- Freight included
-              'P', NULL, Cur_Invoice.C_Charge_ID, Cur_Invoice.ChargeAmt,
-              '3', -- PickUp, High Priority
-              'DR', 'CO', 'N', 'N'
-              );
-            --
-           
-            -- Lines
-            FOR Cur_Lines IN
-              (SELECT *
-              FROM C_INVOICELINE
-              WHERE C_Invoice_ID=p_Invoice_ID
-              AND M_Product_ID IS NOT NULL) LOOP
-              Ad_Sequence_Next('M_InOutLine', Cur_Invoice.C_Invoice_ID, v_NextNo) ;
-              DBMS_OUTPUT.PUT_LINE('    Line* ' || Cur_Lines.Line) ;
-              v_ResultStr:='CreateInOutLine*3';
-              INSERT INTO M_INOUTLINE
-                (M_InOutLine_ID, Line, M_InOut_ID, C_OrderLine_ID,
-                AD_Client_ID, AD_Org_ID, IsActive, Created,
-                CreatedBy, Updated, UpdatedBy, M_Product_ID,
-                C_UOM_ID, M_Locator_ID, MovementQty, Description,
-                IsInvoiced,
-                --MODIFIED BY F.IRIAZABAL
-                QuantityOrder, M_Product_Uom_ID, M_AttributeSetInstance_ID
-                )
-              VALUES
-                (v_NextNo, Cur_Lines.Line, p_InOut_ID, Cur_Lines.C_OrderLine_ID,
-                Cur_Lines.AD_Client_ID, Cur_Lines.AD_Org_ID, 'Y', now(),
-                v_User_ID, now(), v_User_ID, Cur_Lines.M_Product_ID,
-                Cur_Lines.C_UOM_ID, p_Locator_ID, Cur_Lines.QtyInvoiced, Cur_Lines.Description,
-                'Y',
-                --MODIFIED BY F.IRIAZABAL
-                Cur_Lines.QuantityOrder, Cur_Lines.M_Product_Uom_ID, Cur_Lines.M_ATTRIBUTESETINSTANCE_ID
-                );
-              UPDATE C_INVOICELINE
-              SET M_INOUTLINE_ID=v_NextNo,
+        -- Lines
+        FOR Cur_Lines IN (
+            SELECT *
+            FROM C_INVOICELINE
+            WHERE C_Invoice_ID=p_Invoice_ID
+              AND M_Product_ID IS NOT NULL
+        ) LOOP
+          Ad_Sequence_Next('M_InOutLine', Cur_Invoice.C_Invoice_ID, v_NextNo) ;
+          DBMS_OUTPUT.PUT_LINE('    Line* ' || Cur_Lines.Line) ;
+          v_ResultStr:='CreateInOutLine*3';
+          INSERT INTO M_INOUTLINE (
+            M_InOutLine_ID, Line, M_InOut_ID, C_OrderLine_ID,
+            AD_Client_ID, AD_Org_ID, IsActive, Created,
+            CreatedBy, Updated, UpdatedBy, M_Product_ID,
+            C_UOM_ID, M_Locator_ID, MovementQty, Description,
+            IsInvoiced,
+            --MODIFIED BY F.IRIAZABAL
+            QuantityOrder, M_Product_Uom_ID, M_AttributeSetInstance_ID
+          ) VALUES (
+            v_NextNo, Cur_Lines.Line, p_InOut_ID, Cur_Lines.C_OrderLine_ID,
+            Cur_Lines.AD_Client_ID, Cur_Lines.AD_Org_ID, 'Y', now(),
+            v_User_ID, now(), v_User_ID, Cur_Lines.M_Product_ID,
+            Cur_Lines.C_UOM_ID, p_Locator_ID, Cur_Lines.QtyInvoiced, Cur_Lines.Description,
+            'Y',
+            --MODIFIED BY F.IRIAZABAL
+            Cur_Lines.QuantityOrder, Cur_Lines.M_Product_Uom_ID, Cur_Lines.M_ATTRIBUTESETINSTANCE_ID
+          );
+          UPDATE C_INVOICELINE
+          SET M_INOUTLINE_ID=v_NextNo,
               Updated=now(),
               UpdatedBy=v_User_ID
-              WHERE C_INVOICELINE_ID=Cur_Lines.C_INVOICELINE_ID;
-            END LOOP; -- InvoiceLines
-          END LOOP; -- Invoices
+          WHERE C_INVOICELINE_ID=Cur_Lines.C_INVOICELINE_ID;
+        END LOOP; -- InvoiceLines
+      END LOOP; -- Invoices
 
-            v_PostResult := NULL;
+      v_PostResult := NULL;
 
-            --M_Inout_Create - Calling Post Process
-            --Extension point at the end of the M_Inout_Create. It has 4 available parameters Record_ID, DocAction, User and Result
-            SELECT count(*) INTO v_count
-            FROM DUAL
-            where exists (select 1 from ad_ep_procedures where ad_extension_points_id = '18625A6DBF3944A98E6DC375BF88C1EA');
-            IF (v_count=1) THEN
-              DECLARE
-                v_ep_instance VARCHAR2(32);
-                v_extension_point_id VARCHAR2(32) := '18625A6DBF3944A98E6DC375BF88C1EA';
-              BEGIN
-                v_ep_instance := get_uuid();
-                AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'Record_ID',
-                  p_InOut_ID, NULL, NULL, NULL, NULL, NULL, NULL);
-                AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'DocAction',
-                  'CO', NULL, NULL, NULL, NULL, NULL, NULL);
-                AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'User',
-                  v_User_ID, NULL, NULL, NULL, NULL, NULL, NULL);
-                AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'Result',
-                  NULL, NULL, v_PostResult, NULL, NULL, NULL, NULL);
-                AD_EXTENSION_POINT_HANDLER(v_ep_instance, v_extension_point_id);
-                SELECT p_number INTO v_PostResult
-                FROM ad_ep_instance_para
-                WHERE ad_ep_instance_id = v_ep_instance
-                  AND parametername LIKE 'Result';
+      --M_Inout_Create - Calling Post Process
+      --Extension point at the end of the M_Inout_Create. It has 4 available parameters Record_ID, DocAction, User and Result
+      SELECT count(*) INTO v_count
+      FROM DUAL
+      where exists (select 1 from ad_ep_procedures where ad_extension_points_id = '18625A6DBF3944A98E6DC375BF88C1EA');
+      IF (v_count=1) THEN
+        DECLARE
+          v_ep_instance VARCHAR2(32);
+          v_extension_point_id VARCHAR2(32) := '18625A6DBF3944A98E6DC375BF88C1EA';
+        BEGIN
+          v_ep_instance := get_uuid();
+          AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'Record_ID',
+            p_InOut_ID, NULL, NULL, NULL, NULL, NULL, NULL);
+          AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'DocAction',
+            'CO', NULL, NULL, NULL, NULL, NULL, NULL);
+          AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'User',
+            v_User_ID, NULL, NULL, NULL, NULL, NULL, NULL);
+          AD_EP_INSTANCE_PARA_INSERT(v_ep_instance, v_extension_point_id, 'Result',
+            NULL, NULL, v_PostResult, NULL, NULL, NULL, NULL);
+          AD_EXTENSION_POINT_HANDLER(v_ep_instance, v_extension_point_id);
+          SELECT p_number INTO v_PostResult
+          FROM ad_ep_instance_para
+          WHERE ad_ep_instance_id = v_ep_instance
+            AND parametername LIKE 'Result';
 
-                DELETE FROM ad_ep_instance_para
-                WHERE ad_ep_instance_id = v_ep_instance;
-              END;
-            END IF;
+          DELETE FROM ad_ep_instance_para
+          WHERE ad_ep_instance_id = v_ep_instance;
+        END;
+      END IF;
 
-            IF (v_PostResult IS NULL) THEN
-                -- Post Shipment
-                M_INOUT_POST(NULL, p_InOut_ID) ;
-            END IF;
+      IF (v_PostResult IS NULL) THEN
+          -- Post Shipment
+          M_INOUT_POST(NULL, p_InOut_ID) ;
+      END IF;
 
-		  --ADDED BY P.SAROBE
-		  SELECT documentno
-		  INTO v_DocumentNo
-		  FROM 	 M_INOUT
-		  WHERE m_inout_id=p_InOut_ID;
-		  v_Message:='@InoutDocumentno@ ' || v_DocumentNo || ' @beenCreated@';
-        END;
-      END IF;--FINISH_PROCESS
-      /*************************************************************************/
-      --<<FINISH_PROCESS>>
-      IF(p_PInstance_ID IS NOT NULL) THEN
-        --  Update AD_PInstance
-      IF (NOT v_isWholeLog) THEN
-	v_Message := 'First ' || v_logLines || ' result(s):' || '<br>' || v_Message || '...';
-      END IF;
-	
-        DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
-        AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', v_result, v_Message) ;
-      ELSE
-        DBMS_OUTPUT.PUT_LINE('--<<M_InOut_Create finished>> ' || v_Message);
-      END IF;
-      --
-      RETURN;
-    END; --BODY
+      --ADDED BY P.SAROBE
+      SELECT documentno
+        INTO v_DocumentNo
+      FROM M_INOUT
+      WHERE m_inout_id=p_InOut_ID;
+      v_Message:='@InoutDocumentno@ ' || v_DocumentNo || ' @beenCreated@';
+    END;
+  END IF;
+  /*************************************************************************/
+  --<<FINISH_PROCESS>>
+  IF (p_PInstance_ID IS NOT NULL) THEN
+    --  Update AD_PInstance
+    IF (NOT v_isWholeLog) THEN
+      v_Message := 'First ' || v_logLines || ' result(s):' || '<br>' || v_Message || '...';
+    END IF;
+  
+    DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
+    AD_UPDATE_PINSTANCE(p_PInstance_ID, NULL, 'N', v_result, v_Message) ;
+  ELSE
+    DBMS_OUTPUT.PUT_LINE('--<<M_InOut_Create finished>> ' || v_Message);
+  END IF;
+  --
+  RETURN;
+END; --BODY
 EXCEPTION
 WHEN OTHERS THEN
   v_ResultStr:= '@ERROR=' || SQLERRM;
--- a/src-db/database/model/functions/M_PRODUCTION_RUN.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/model/functions/M_PRODUCTION_RUN.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -42,581 +42,478 @@
   v_is_ready AD_Org.IsReady%TYPE;
   v_is_tr_allow AD_OrgType.IsTransactionsAllowed%TYPE;
   v_isacctle AD_OrgType.IsAcctLegalEntity%TYPE;
-  v_org_bule_id AD_Org.AD_Org_ID%TYPE;
   -- Parameter
   TYPE RECORD IS REF CURSOR;
     Cur_Parameter RECORD;
-    -- Parameter Variables
-    MustBeStocked CHAR(1) ;
-    v_IsCreated CHAR(1) ;
-    v_Processed VARCHAR2(60) ;
-    v_Client_ID VARCHAR2(32);
-    v_Org_ID VARCHAR2(32);
-    --
-    v_Line NUMBER;
-    NextNo VARCHAR2(32);
-    CountNo NUMBER;
-    v_Count NUMBER;
-    v_Qty NUMBER;
-    v_QtyAcumulated NUMBER;
-    v_QtyOrder NUMBER;
-    p_Warehouse VARCHAR2(32);
-    p_User VARCHAR2(32);
-    v_Product_Name VARCHAR2(2000):='';
-    -- ProductionPlan
     CUR_PP RECORD;
-    -- BOM Lines
-    CUR_BOM RECORD;
-    -- Stocked BOMs
-    CURSOR CUR_STOCK (Product_ID VARCHAR, UOM VARCHAR, Warehouse_ID VARCHAR, Org_ID VARCHAR) IS
-      SELECT T.M_PRODUCT_ID,
-        T.C_UOM_ID,
-        T.M_LOCATOR_ID,
-        T.M_ATTRIBUTESETINSTANCE_ID,
-        T.M_PRODUCT_UOM_ID,
-        COALESCE(T.QtyOnHand, 0) AS Qty,
-        T.QtyOrderOnHand AS QtyOrder
-      FROM M_STORAGE_DETAIL T LEFT OUTER JOIN
-        M_ATTRIBUTESETINSTANCE A
-        ON T.M_ATTRIBUTESETINSTANCE_ID = A.M_ATTRIBUTESETINSTANCE_ID,
-        M_LOCATOR L, M_WAREHOUSE W
-      WHERE T.M_PRODUCT_ID=Product_ID
-        AND T.C_UOM_ID=UOM
-        AND T.M_LOCATOR_ID=L.M_LOCATOR_ID
-        AND COALESCE(T.QtyOnHand, 0)>0
-        AND L.M_WAREHOUSE_ID = W.M_WAREHOUSE_ID
-        AND ad_isorgincluded(Org_ID, W.AD_ORG_ID, W.AD_CLIENT_ID) <> -1
-      ORDER BY(
-        CASE L.M_WAREHOUSE_ID WHEN Warehouse_ID THEN 1 ELSE 2
-        END
-        ),
-        L.PRIORITYNO,
-        A.CREATED, T.CREATED,
-        T.M_PRODUCT_UOM_ID;
-      v_storage CUR_STOCK%ROWTYPE;
-      -- ProductionLines which are non-stocked BOMs (need to be resolved)
-      CUR_PLineBOM RECORD;
-      CUR_BOM_PRODUCT RECORD;
-      -- Posting
-      CUR_PL_Post RECORD;
-      FINISH_PROCESS BOOLEAN:=false;
-      NEXT_PRODUCT BOOLEAN:=false;
-      CUR_STOCK_ISOPEN BOOLEAN:=false;
+    CUR_PLineBOM RECORD;
+    CUR_BOM_PRODUCT RECORD;
+    CUR_PL_Post RECORD;
+  -- Parameter Variables
+  MustBeStocked CHAR(1) ;
+  v_IsCreated CHAR(1) ;
+  v_Processed VARCHAR2(60) ;
+  v_Client_ID VARCHAR2(32);
+  v_Org_ID VARCHAR2(32);
+  --
+  v_Line NUMBER;
+  v_Count NUMBER;
+  p_User VARCHAR2(32);
+  v_Product_Name VARCHAR2(2000):='';
+  -- Stocked BOMs
+  -- Proposed stock from given warehouse is priorized.
+  CURSOR CUR_STOCK (v_ad_pinstance_id VARCHAR) IS
+      SELECT sd.m_product_id, sd.m_locator_id, sd.m_attributesetinstance_id,
+          sd.c_uom_id, sd.m_product_uom_id, u.stdprecision,
+          ms.quantity AS qty, ms.qtyorder AS qtyorder,
+          ms.priority
+      FROM m_stock_proposed ms 
+            LEFT JOIN m_storage_detail sd ON ms.m_storage_detail_id = sd.m_storage_detail_id
+            LEFT JOIN m_product_uom pu ON sd.m_product_uom_id = pu.m_product_uom_id
+            LEFT JOIN c_uom u ON pu.c_uom_id = u.c_uom_id
+            LEFT JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
+      WHERE ms.ad_pinstance_id = v_ad_pinstance_id
+      ORDER BY ms.priority;
+  v_storage CUR_STOCK%ROWTYPE;
+  NEXT_PRODUCT BOOLEAN:=false;
+  CUR_STOCK_ISOPEN BOOLEAN:=false;
+BEGIN
+  --  Update AD_PInstance
+  DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || PInstance_ID) ;
+  v_ResultStr:='PInstanceNotFound';
+  AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'Y', NULL, NULL) ;
+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;
+    p_User := Cur_Parameter.AD_User_ID;
+    IF (Cur_Parameter.ParameterName = 'MustBeStocked') THEN
+      MustBeStocked:=Cur_Parameter.P_String;
+      DBMS_OUTPUT.PUT_LINE('  MustBeStocked=' || MustBeStocked) ;
+    ELSE
+      DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ;
+    END IF;
+  END LOOP; -- Get Parameter
+  DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
+  -- Processing:1:2:3 Lock :4:5:6:7
+  -- TODO
+  /**
+  * Get Info + Lock
+  */
+  v_ResultStr:='ReadingRecord';
+  SELECT IsCreated, Processed, AD_Client_ID, AD_Org_ID, MovementDate
+    INTO v_IsCreated, v_Processed, v_Client_ID, v_Org_ID, v_MovementDate
+  FROM M_PRODUCTION
+  WHERE M_Production_ID=v_Record_ID  FOR UPDATE;
+  /**
+  * No Action
+  */
+  IF (v_Processed <> 'N') THEN
+    v_Message:='@AlreadyPosted@';
+    RAISE_APPLICATION_ERROR(-20000, v_Message);
+  END IF;
+  /**************************************************************************
+  * Create Lines
+  */
+  /***************************************************************************/
+  -- Check the header belongs to a organization where transactions are posible and ready to use
+  SELECT AD_Org.IsReady, Ad_OrgType.IsTransactionsAllowed
+    INTO v_is_ready, v_is_tr_allow
+  FROM M_PRODUCTION, AD_Org, AD_OrgType
+  WHERE AD_Org.AD_Org_ID=M_PRODUCTION.AD_Org_ID
+    AND AD_Org.AD_OrgType_ID=AD_OrgType.AD_OrgType_ID
+    AND M_PRODUCTION.M_PRODUCTION_ID=v_Record_ID;
+  IF (v_is_ready='N') THEN
+    RAISE_APPLICATION_ERROR(-20000, '@OrgHeaderNotReady@');
+  END IF;
+  IF (v_is_tr_allow='N') THEN
+    RAISE_APPLICATION_ERROR(-20000, '@OrgHeaderNotTransAllowed@');
+  END IF;
+  
+  -- Check the lines belong to the same business unit or legal entity as the header    
+  SELECT AD_ORG_CHK_DOCUMENTS('M_PRODUCTION', 'M_PRODUCTIONPLAN', v_Record_ID, 'M_PRODUCTION_ID', 'M_PRODUCTION_ID') INTO v_is_included FROM dual;
+  IF (v_is_included = -1) THEN
+    RAISE_APPLICATION_ERROR(-20000, '@LinesAndHeaderDifferentLEorBU@');
+  END IF;
+  FOR CUR_PP IN (
+      SELECT M_PRODUCTIONPLAN_ID
+      FROM M_PRODUCTIONPLAN
+      WHERE M_PRODUCTION_ID = v_Record_ID
+  ) LOOP
+    SELECT AD_ORG_CHK_DOCUMENTS('M_PRODUCTIONPLAN', 'M_PRODUCTIONLINE', CUR_PP.M_PRODUCTIONPLAN_ID, 'M_PRODUCTIONPLAN_ID', 'M_PRODUCTIONPLAN_ID') INTO v_is_included FROM dual;
+    IF (v_is_included = -1) THEN
+      RAISE_APPLICATION_ERROR(-20000, '@LinesAndHeaderDifferentLEorBU@');
+    END IF;
+  END LOOP;
+  
+  -- Check the period control is opened (only if it is legal entity with accounting)
+  -- Gets the BU or LE of the document
+  SELECT AD_OrgType.IsAcctLegalEntity INTO v_isacctle
+  FROM AD_OrgType, AD_Org
+  WHERE AD_Org.AD_OrgType_ID = AD_OrgType.AD_OrgType_ID
+    AND AD_Org.AD_Org_ID = AD_GET_DOC_LE_BU('M_PRODUCTION', v_Record_ID, 'M_PRODUCTION_ID', 'LE');
+
+  IF (v_isacctle='Y') THEN
+    SELECT C_CHK_OPEN_PERIOD(v_Org_ID, v_MovementDate, 'MMP', NULL)  INTO v_available_period FROM DUAL;
+
+    IF (v_available_period<>1) THEN
+      RAISE_APPLICATION_ERROR(-20000, '@PeriodNotAvailable@');
+    END IF;
+  END IF;
+
+  IF (v_IsCreated <> 'Y') THEN
+    -- For every Production Plan
+    FOR CUR_PP IN (
+        SELECT M_PRODUCTIONPLAN.*, M_PRODUCT.C_UOM_ID,
+            (CASE WHEN M_PRODUCT.ATTRSETVALUETYPE='D' THEN M_PRODUCT.M_AttributeSetInstance_ID ELSE NULL END) AS M_AttributeSetInstance_ID
+        FROM M_PRODUCTIONPLAN, M_PRODUCT
+        WHERE M_PRODUCTIONPLAN.M_Product_ID=M_PRODUCT.M_Product_ID
+          AND M_PRODUCTIONPLAN.M_Production_ID=v_Record_ID
+        ORDER BY M_PRODUCTIONPLAN.Line, M_PRODUCTIONPLAN.M_Product_ID
+    ) LOOP
+      IF (CUR_PP.M_Locator_ID IS NULL) THEN
+        RAISE_APPLICATION_ERROR(-20000, '@ProductionPlanLocatorNeeded@');
+      END IF;
+      -- Delete prior lines
+      DELETE
+      FROM M_PRODUCTIONLINE
+      WHERE M_ProductionPlan_ID=CUR_PP.M_ProductionPlan_ID;
+      -- Create BOM Line
+      v_ResultStr:='CreatingLine BOM';
+      v_Line:=10; -- OriginLine
+      INSERT INTO M_PRODUCTIONLINE (
+          M_ProductionLine_ID, M_ProductionPlan_ID, Line, AD_Client_ID,
+          AD_Org_ID, IsActive, Created, CreatedBy,
+          Updated, UpdatedBy, M_Product_ID, MovementQty,
+          M_Locator_ID, Description, C_UOM_ID,
+          M_AttributeSetInstance_ID
+      ) VALUES (
+          get_uuid(), CUR_PP.M_ProductionPlan_ID, v_Line, CUR_PP.AD_Client_ID,
+          CUR_PP.AD_Org_ID, 'Y', now(), p_User,
+          now(), p_User, CUR_PP.M_Product_ID, CUR_PP.ProductionQty,
+          CUR_PP.M_Locator_ID, CUR_PP.Description, CUR_PP.C_UOM_ID,
+          CUR_PP.M_AttributeSetInstance_ID
+      );
+    END LOOP;
+    --Creating BOM Lines
+    DECLARE
+      v_Product_old VARCHAR2(32);
+      v_Warehouse_old VARCHAR2(32);
+      v_UOM_old VARCHAR2(32);
+      v_Qty NUMBER;
+      v_QtyStorage NUMBER:=0;
+      v_QtyAcumulated NUMBER;
+      v_QtyOrder NUMBER;
+      v_pinstance_id VARCHAR2(32);
+      CUR_BOM RECORD;
     BEGIN
-      --  Update AD_PInstance
-      DBMS_OUTPUT.PUT_LINE('Updating PInstance - Processing ' || PInstance_ID) ;
-      v_ResultStr:='PInstanceNotFound';
-      AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'Y', NULL, NULL) ;
-    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;
-        p_User:=Cur_Parameter.AD_User_ID;
-        IF(Cur_Parameter.ParameterName='MustBeStocked') THEN
-          MustBeStocked:=Cur_Parameter.P_String;
-          DBMS_OUTPUT.PUT_LINE('  MustBeStocked=' || MustBeStocked) ;
-        ELSE
-          DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ;
-        END IF;
-      END LOOP; -- Get Parameter
-      DBMS_OUTPUT.PUT_LINE('  Record_ID=' || v_Record_ID) ;
-      -- Processing:1:2:3 Lock :4:5:6:7
-      -- TODO
-      /**
-      * Get Info + Lock
-      */
-      v_ResultStr:='ReadingRecord';
-      SELECT IsCreated,
-        Processed,
-        AD_Client_ID,
-        AD_Org_ID, MovementDate
-      INTO v_IsCreated,
-        v_Processed,
-        v_Client_ID,
-        v_Org_ID, v_MovementDate
-      FROM M_PRODUCTION
-      WHERE M_Production_ID=v_Record_ID  FOR UPDATE;
-      /**
-      * No Action
-      */
-      IF(v_Processed<>'N') THEN
-        v_Message:='@AlreadyPosted@';
-        RAISE_APPLICATION_ERROR(-20000, v_Message);
-        FINISH_PROCESS:=true;
-      END IF;
-      /**************************************************************************
-      * Create Lines
-      */
-      IF(NOT FINISH_PROCESS) THEN
-        /***************************************************************************/
-        -- Check the header belongs to a organization where transactions are posible and ready to use
-        SELECT AD_Org.IsReady, Ad_OrgType.IsTransactionsAllowed
-        INTO v_is_ready, v_is_tr_allow
-        FROM M_PRODUCTION, AD_Org, AD_OrgType
-        WHERE AD_Org.AD_Org_ID=M_PRODUCTION.AD_Org_ID
-        AND AD_Org.AD_OrgType_ID=AD_OrgType.AD_OrgType_ID
-        AND M_PRODUCTION.M_PRODUCTION_ID=v_Record_ID;
-        IF (v_is_ready='N') THEN
-          RAISE_APPLICATION_ERROR(-20000, '@OrgHeaderNotReady@');
-        END IF;
-        IF (v_is_tr_allow='N') THEN
-          RAISE_APPLICATION_ERROR(-20000, '@OrgHeaderNotTransAllowed@');
-        END IF;
-        
-	    -- Check the lines belong to the same business unit or legal entity as the header    
-        SELECT AD_ORG_CHK_DOCUMENTS('M_PRODUCTION', 'M_PRODUCTIONPLAN', v_Record_ID, 'M_PRODUCTION_ID', 'M_PRODUCTION_ID') INTO v_is_included FROM dual;
-        IF (v_is_included=-1) THEN
-          RAISE_APPLICATION_ERROR(-20000, '@LinesAndHeaderDifferentLEorBU@');
-        END IF;
-        FOR CUR_PP IN
-          (SELECT M_PRODUCTIONPLAN_ID
-           FROM M_PRODUCTIONPLAN
-           WHERE M_PRODUCTION_ID = v_Record_ID) LOOP
-          SELECT AD_ORG_CHK_DOCUMENTS('M_PRODUCTIONPLAN', 'M_PRODUCTIONLINE', CUR_PP.M_PRODUCTIONPLAN_ID, 'M_PRODUCTIONPLAN_ID', 'M_PRODUCTIONPLAN_ID') INTO v_is_included FROM dual;
-          IF (v_is_included=-1) THEN
-            RAISE_APPLICATION_ERROR(-20000, '@LinesAndHeaderDifferentLEorBU@');
-          END IF;
-        END LOOP;        
-        
-        -- Check the period control is opened (only if it is legal entity with accounting)
-        -- Gets the BU or LE of the document
-        SELECT AD_GET_DOC_LE_BU('M_PRODUCTION', v_Record_ID, 'M_PRODUCTION_ID', 'LE')
-        INTO v_org_bule_id
-        FROM DUAL;
-        
-        SELECT AD_OrgType.IsAcctLegalEntity
-        INTO v_isacctle
-        FROM AD_OrgType, AD_Org
-        WHERE AD_Org.AD_OrgType_ID = AD_OrgType.AD_OrgType_ID
-        AND AD_Org.AD_Org_ID=v_org_bule_id;
-        
-        IF (v_isacctle='Y') THEN
-          SELECT C_CHK_OPEN_PERIOD(v_Org_ID, v_MovementDate, 'MMP', NULL) 
-          INTO v_available_period
-          FROM DUAL;
-          
-          IF (v_available_period<>1) THEN
-            RAISE_APPLICATION_ERROR(-20000, '@PeriodNotAvailable@');
-          END IF;
-        END IF;
-        
-        
-        
-        IF(v_IsCreated<>'Y') THEN
-          -- For every Production Plan
-          FOR CUR_PP IN
-            (SELECT M_PRODUCTIONPLAN.*,
-              M_PRODUCT.C_UOM_ID,  
-              (CASE WHEN M_PRODUCT.ATTRSETVALUETYPE='D' THEN M_PRODUCT.M_AttributeSetInstance_ID ELSE NULL END) AS M_AttributeSetInstance_ID
-            FROM M_PRODUCTIONPLAN,
-              M_PRODUCT
-            WHERE M_PRODUCTIONPLAN.M_Product_ID=M_PRODUCT.M_Product_ID
-              AND M_PRODUCTIONPLAN.M_Production_ID=v_Record_ID
-            ORDER BY M_PRODUCTIONPLAN.Line,
-              M_PRODUCTIONPLAN.M_Product_ID
-            )
-          LOOP
-            IF (CUR_PP.M_Locator_ID IS NULL) THEN
-		RAISE_APPLICATION_ERROR(-20000, '@ProductionPlanLocatorNeeded@');
-            END IF;
-            -- Delete prior lines
-            DELETE
-            FROM M_PRODUCTIONLINE
-            WHERE M_ProductionPlan_ID=CUR_PP.M_ProductionPlan_ID;
-            -- Create BOM Line
-            v_ResultStr:='CreatingLine BOM';
-            v_Line:=10; -- OriginLine
-            Ad_Sequence_Next('M_ProductionLine', CUR_PP.AD_Client_ID, NextNo) ;
-            INSERT
-            INTO M_PRODUCTIONLINE
-              (
-                M_ProductionLine_ID, M_ProductionPlan_ID, Line, AD_Client_ID,
-                AD_Org_ID, IsActive, Created, CreatedBy,
-                Updated, UpdatedBy, M_Product_ID, MovementQty,
-                M_Locator_ID, Description, C_UOM_ID,
-                M_AttributeSetInstance_ID
-              )
-              VALUES
-              (
-                NextNo, CUR_PP.M_ProductionPlan_ID, v_Line, CUR_PP.AD_Client_ID,
-                CUR_PP.AD_Org_ID, 'Y', now(), p_User,
-                now(), p_User, CUR_PP.M_Product_ID, CUR_PP.ProductionQty,
-                CUR_PP.M_Locator_ID, CUR_PP.Description, CUR_PP.C_UOM_ID,
-                CUR_PP.M_AttributeSetInstance_ID
-              )
-              ;
-          END LOOP;
-          --Creating BOM Lines
-          DECLARE
-            v_Product_old VARCHAR2(32);
-            v_Warehouse_old VARCHAR2(32);
-            v_UOM_old VARCHAR2(32);
-            v_Warehouse_old_org VARCHAR2(32);
-            v_QtyStorage NUMBER:=0;
-          BEGIN
-            FOR CUR_BOM IN
-              (SELECT pb.*,
-                p.C_UOM_ID,
-                p.IsStocked,
-                pp.M_LOCATOR_ID,
-                pp.AD_Org_ID AS ORG_ID,
-                pp.ProductionQty,
-                pp.M_ProductionPlan_ID,
-                pp.AD_Client_ID AS Client_ID,
-                p.name as pname
-              FROM M_PRODUCT_BOM pb,
-                M_PRODUCT p,
-                M_PRODUCTIONPLAN pp
-              WHERE pb.M_ProductBOM_ID=p.M_Product_ID
-                AND pb.M_Product_ID=pp.M_PRODUCT_ID
-                AND pp.M_PRODUCTION_ID=v_Record_ID
-                AND pb.isactive='Y'
-              ORDER BY pb.M_PRODUCTBOM_ID,
-                pb.Line
-              )
-            LOOP
-              v_ResultStr:='CreatingLine Products';
-              IF(CUR_BOM.IsStocked='Y') THEN
-                v_QtyAcumulated:=0;
-                SELECT M_WAREHOUSE_ID
-                INTO p_Warehouse
-                FROM M_LOCATOR
-                WHERE M_LOCATOR_ID=CUR_BOM.M_LOCATOR_ID;
-                IF(NOT CUR_STOCK_ISOPEN) OR (v_Product_old<>CUR_BOM.M_ProductBOM_ID OR v_Warehouse_old<>p_Warehouse OR  v_UOM_old<>CUR_BOM.C_UOM_ID) THEN
-                  v_Product_old:=CUR_BOM.M_ProductBOM_ID;
-                  v_Warehouse_old:=p_Warehouse;
-                  v_UOM_old:=CUR_BOM.C_UOM_ID;
-                  SELECT ad_org_id INTO v_Warehouse_old_org
-                  FROM m_warehouse
-                  WHERE m_warehouse_id = v_Warehouse_old;
-                  IF(CUR_STOCK_ISOPEN) THEN
-                    CLOSE CUR_STOCK;
-                    CUR_STOCK_ISOPEN:=false;
-                  END IF;
-                  OPEN CUR_STOCK(v_Product_old, v_UOM_old, v_Warehouse_old, v_warehouse_old_org);
-                  CUR_STOCK_ISOPEN:=true;
-                  FETCH CUR_STOCK INTO v_storage;
-                  IF CUR_STOCK%NOTFOUND THEN
-                    NEXT_PRODUCT:=true;
-                  END IF;
-                  v_QtyStorage:=v_storage.Qty;
-                END IF;
-                IF(NOT NEXT_PRODUCT) THEN
-                  LOOP
-                    v_Qty:=LEAST(v_QtyStorage, CUR_BOM.ProductionQty*CUR_BOM.BOMQty - v_QtyAcumulated) ;
-                    v_QtyStorage:=v_QtyStorage - v_Qty;
-                    v_QtyAcumulated:=v_QtyAcumulated + v_Qty;
-                    v_QtyOrder:=v_storage.QtyOrder*(v_Qty/v_storage.Qty) ;
-                    SELECT COALESCE(MAX(Line), 0) + 10
-                    INTO v_Line
-                    FROM M_PRODUCTIONLINE
-                    WHERE M_ProductionPlan_ID=CUR_BOM.M_ProductionPlan_ID;
-                    Ad_Sequence_Next('M_ProductionLine', CUR_BOM.Client_ID, NextNo) ;
-                    INSERT
-                    INTO M_PRODUCTIONLINE
-                      (
-                        M_ProductionLine_ID, M_ProductionPlan_ID, Line, AD_Client_ID,
-                        AD_Org_ID, IsActive, Created, CreatedBy,
-                        Updated, UpdatedBy, M_Product_ID, C_UOM_ID,
-                        MovementQty, M_Locator_ID, 
-                        M_AttributeSetInstance_ID, 
-                        M_Product_UOM_ID,
-                        QuantityOrder
-                      )
-                      VALUES
-                      (
-                        NextNo, CUR_BOM.M_ProductionPlan_ID, v_Line, CUR_BOM.Client_ID,
-                        CUR_BOM.Org_ID, 'Y', now(), p_User,
-                        now(), p_User, CUR_BOM.M_ProductBOM_ID, CUR_BOM.C_UOM_ID,
-                        -v_Qty, v_storage.M_Locator_ID, 
-                        (CASE WHEN (SELECT ATTRSETVALUETYPE FROM M_PRODUCT WHERE M_PRODUCT_ID=CUR_BOM.M_ProductBOM_ID)='F' THEN NULL ELSE v_storage.M_AttributeSetInstance_ID END), 
-                        v_storage.M_Product_UOM_ID,
-                        -v_QtyOrder
-                      )
-                      ;
-                    IF(v_QtyAcumulated>=CUR_BOM.ProductionQty*CUR_BOM.BOMQty) THEN
-                      EXIT;
-                    END IF;
-                    v_QtyStorage:=0;
-                    v_ResultStr:='FetchingData';
-                    FETCH CUR_STOCK INTO v_storage;
-                    IF CUR_STOCK%NOTFOUND THEN
-                      CLOSE CUR_STOCK;
-                      CUR_STOCK_ISOPEN:=false;
-                      EXIT;
-                    END IF;
-                    v_QtyStorage:=v_storage.Qty;
-                  END LOOP;
-                END IF; --NEXT_PRODUCT
-              ELSE
-                SELECT COALESCE(MAX(Line), 0) + 10
-                INTO v_Line
-                FROM M_PRODUCTIONLINE
-                WHERE M_ProductionPlan_ID=CUR_BOM.M_ProductionPlan_ID;
-                Ad_Sequence_Next('M_ProductionLine', CUR_BOM.Client_ID, NextNo) ;
-                INSERT
-                INTO M_PRODUCTIONLINE
-                  (
-                    M_ProductionLine_ID, M_ProductionPlan_ID, Line, AD_Client_ID,
-                    AD_Org_ID, IsActive, Created, CreatedBy,
-                    Updated, UpdatedBy, M_Product_ID, MovementQty,
-                    M_Locator_ID, C_UOM_ID
-                  )
-                  VALUES
-                  (
-                    NextNo, CUR_BOM.M_ProductionPlan_ID, v_Line, CUR_BOM.Client_ID,
-                    CUR_BOM.Org_ID, 'Y', now(), p_User,
-                    now(), p_User, CUR_BOM.M_ProductBOM_ID, -CUR_BOM.ProductionQty*CUR_BOM.BOMQty,
-                    CUR_BOM.M_Locator_ID, CUR_BOM.C_UOM_ID
-                  )
-                  ;
-              END IF;
-              --<<NEXT_PRODUCT>>
-              NEXT_PRODUCT:=false;
-              v_Line:=v_Line;
-              IF (v_QtyAcumulated < CUR_BOM.BOMQTY*CUR_BOM.ProductionQty) AND MustBeStocked='Y' THEN
-                v_Message := '@NotEnoughStocked@: ' || CUR_BOM.pname || ' ' || v_QtyAcumulated || ' / '|| CUR_BOM.BOMQTY*CUR_BOM.ProductionQty;
-                ROLLBACK;
-                RAISE_APPLICATION_ERROR(-20000, v_Message);
-              END IF;
-              IF (CUR_BOM.ProductionQty <= 0) THEN
-                v_Message := '@NegativeBOMProductionQty@';
-                ROLLBACK;
-                RAISE_APPLICATION_ERROR(-20000, v_Message);
-              END IF;
-            END LOOP;
-            IF(CUR_STOCK_ISOPEN) THEN
+      FOR CUR_BOM IN (
+          SELECT pb.*,
+              p.C_UOM_ID, p.IsStocked, pp.M_LOCATOR_ID, pp.AD_Org_ID AS ORG_ID,
+              pp.ProductionQty, pp.M_ProductionPlan_ID, pp.AD_Client_ID AS Client_ID, p.name as pname,
+              l.m_warehouse_id
+          FROM M_PRODUCT_BOM pb
+              JOIN M_PRODUCT p ON pb.M_ProductBOM_ID=p.M_Product_ID
+              JOIN M_PRODUCTIONPLAN pp ON pb.M_Product_ID=pp.M_PRODUCT_ID
+              JOIN M_LOCATOR l ON pp.m_locator_id = l.m_locator_id
+        WHERE pp.M_PRODUCTION_ID=v_Record_ID
+          AND pb.isactive='Y'
+        ORDER BY pb.M_PRODUCTBOM_ID, pb.Line
+      ) LOOP
+        v_ResultStr:='CreatingLine Products';
+        IF (CUR_BOM.IsStocked = 'Y') THEN
+          v_QtyAcumulated:=0;
+          IF ((NOT CUR_STOCK_ISOPEN) 
+              OR (v_Product_old <> CUR_BOM.M_ProductBOM_ID OR v_Warehouse_old <> cur_bom.m_warehouse_id OR v_UOM_old <> CUR_BOM.C_UOM_ID)) THEN
+            v_product_old := cur_bom.m_productbom_id;
+            v_warehouse_old := cur_bom.m_warehouse_id;
+            v_uom_old := cur_bom.c_uom_id;
+            IF (CUR_STOCK_ISOPEN) THEN
               CLOSE CUR_STOCK;
               CUR_STOCK_ISOPEN:=false;
             END IF;
-          END; --END OF DECLARE FOR BOM PRODUCTS INSERTION
-          -- While we have BOMs
-          LOOP
-            -- Are there non-stored BOMs to list details:8
-            v_ResultStr:='CreatingLine CheckBOM';
-            SELECT COUNT(*)
-            INTO CountNo
-            FROM M_PRODUCTIONLINE pl,
-              M_PRODUCT p,
-              M_PRODUCTIONPLAN pp
-            WHERE pl.M_Product_ID=p.M_Product_ID
-              AND pl.M_ProductionPlan_ID=pp.M_ProductionPlan_ID
-              AND pp.M_PRODUCTION_ID=v_Record_ID
-              AND pl.Line<>10 -- Origin Line
-              AND p.IsBOM='Y'
-              AND p.IsStocked='N';
-            -- Nothing to do
-            EXIT
-          WHEN(CountNo=0) ;
-            --
-            -- Resolve BOMs in ProductLine which are not stocked
-            FOR CUR_PLineBOM IN
-              (SELECT pl.M_ProductionLine_ID,
-                pl.Line,
-                pl.M_Product_ID,
-                pl.MovementQty,
-                pp.M_LOCATOR_ID,
-                pp.AD_Org_ID AS ORG_ID,
-                pp.ProductionQty,
-                pp.M_ProductionPlan_ID,
-                pp.AD_Client_ID AS Client_ID
-              FROM M_PRODUCTIONLINE pl,
-                M_PRODUCT p,
-                M_PRODUCTIONPLAN pp
-              WHERE pl.M_ProductionPlan_ID=pp.M_ProductionPlan_ID
-                AND pp.M_Production_ID=v_Record_ID
-                AND pl.M_Product_ID=p.M_Product_ID
-                AND pl.Line<>10 -- Origin Line
-                AND p.IsBOM='Y'
-                AND p.IsStocked='N'
-              )
+            
+            -- Call M_GET_STOCK
+            DECLARE
+              v_pinstance_result AD_PInstance.result%TYPE;
+              v_pinstance_msg AD_PInstance.errormsg%TYPE;
+            BEGIN
+              v_pinstance_id := get_uuid();
+              INSERT INTO ad_pinstance (
+                  ad_pinstance_id, ad_process_id, record_id, isactive, 
+                  ad_user_id, ad_client_id, ad_org_id, created, createdby,
+                  updated, updatedby
+              ) VALUES (
+                  v_pinstance_id, 'FF80818132C964E30132C9747257002E', v_record_id, 'Y',
+                  p_user, v_client_id, v_org_id, now(), p_user,
+                  now(), p_user
+              );
+
+              AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '10', 'AD_Client_ID', v_client_id, null, null, null, null, null);
+              AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '20', 'AD_Org_ID', cur_bom.org_id, null, null, null, null, null);
+              AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '30', 'M_Product_ID', v_Product_old, null, null, null, null, null);
+              AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '40', 'C_Uom_ID', v_UOM_old, null, null, null, null, null);
+              AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '50', 'M_Product_Uom_ID', null, null, null, null, null, null);
+              -- Records in m_aux_stock are not considered in BOM production.
+              --AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '60', 'AuxID', v_record_id, null, null, null, null, null);
+              --AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '70', 'TableId', '325', null, null, null, null, null);
+              AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '60', 'Priority_Warehouse_ID', v_Warehouse_old, null, null, null, null, null);
+              AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '80', 'LineNo', null, null, 10, null, null, null);
+              AD_PINSTANCE_PARA_INSERT(v_pinstance_id, '90', 'ProcessID', '137', null, null, null, null, null);
+
+              M_GET_STOCK(v_pinstance_ID, 'N');
+              -- Check result
+              SELECT result, errormsg
+                INTO v_pinstance_result, v_pinstance_msg
+              FROM ad_pinstance
+              WHERE ad_pinstance_id = v_pinstance_id;
+              IF (v_pinstance_result = 0) THEN
+                -- Error on m_get_stock
+                RAISE_APPLICATION_ERROR(-20000, v_pinstance_msg);
+              END IF;
+            END; -- End Call M_GET_STOCK
+            
+            OPEN CUR_STOCK(v_pinstance_id);
+            CUR_STOCK_ISOPEN:=true;
+            FETCH CUR_STOCK INTO v_storage;
+            IF (CUR_STOCK%NOTFOUND) THEN
+              NEXT_PRODUCT:=true;
+            END IF;
+            v_qtystorage:=v_storage.qty;
+          END IF;
+          IF (NOT NEXT_PRODUCT) THEN
             LOOP
-              v_ResultStr:='CreatingLineBOM Resolution';
-              v_Line:=CUR_PLineBOM.Line;
-              -- Resolve BOM Line in product line
-              FOR CUR_BOM_PRODUCT IN
-                (SELECT pb.*,
-                  p.C_UOM_ID,
-                  p.IsStocked
-                FROM M_PRODUCT_BOM pb,
-                  M_PRODUCT p
-                WHERE pb.M_ProductBOM_ID=p.M_Product_ID
-                  AND pb.M_Product_ID=CUR_PLineBOM.M_Product_ID
-                  AND pb.isactive='Y'
-                ORDER BY pb.M_PRODUCTBOM_ID,
-                  pb.Line
-                )
-              LOOP
-                v_ResultStr:='CreatingLine Products2';
-                SELECT COALESCE(MAX(Line), 0) + 10
-                INTO v_Line
-                FROM M_PRODUCTIONLINE
-                WHERE M_ProductionPlan_ID=CUR_PLineBOM.M_ProductionPlan_ID;
-                Ad_Sequence_Next('M_ProductionLine', CUR_PLineBOM.Client_ID, NextNo) ;
-                INSERT
-                INTO M_PRODUCTIONLINE
-                  (
-                    M_ProductionLine_ID, M_ProductionPlan_ID, Line, AD_Client_ID,
-                    AD_Org_ID, IsActive, Created, CreatedBy,
-                    Updated, UpdatedBy, M_Product_ID, MovementQty,
-                    M_Locator_ID, C_UOM_ID
-                  )
-                  VALUES
-                  (
-                    NextNo, CUR_PLineBOM.M_ProductionPlan_ID, v_Line, CUR_PLineBOM.Client_ID,
-                    CUR_PLineBOM.Org_ID, 'Y', now(), p_User,
-                    now(), p_User, CUR_BOM_PRODUCT.M_ProductBOM_ID, CUR_PLineBOM.MovementQty*CUR_BOM_PRODUCT.BOMQty,
-                    CUR_PLineBOM.M_Locator_ID, CUR_BOM_PRODUCT.C_UOM_ID
-                  )
-                  ;
-              END LOOP;
-              -- Delete BOM line
-              DELETE
+              v_Qty := LEAST(v_QtyStorage, CUR_BOM.ProductionQty * CUR_BOM.BOMQty - v_QtyAcumulated) ;
+              v_QtyStorage := v_QtyStorage - v_Qty;
+              v_QtyAcumulated := v_QtyAcumulated + v_Qty;
+              v_QtyOrder := ROUND(v_storage.QtyOrder*(v_Qty/v_storage.Qty), v_storage.stdprecision);
+              SELECT COALESCE(MAX(Line), 0) + 10 INTO v_Line
               FROM M_PRODUCTIONLINE
-              WHERE M_ProductionLine_ID=CUR_PLineBOM.M_ProductionLine_ID;
+              WHERE M_ProductionPlan_ID=CUR_BOM.M_ProductionPlan_ID;
+              INSERT INTO M_PRODUCTIONLINE (
+                  M_ProductionLine_ID, M_ProductionPlan_ID, Line, AD_Client_ID,
+                  AD_Org_ID, IsActive, Created, CreatedBy,
+                  Updated, UpdatedBy, M_Product_ID, C_UOM_ID,
+                  MovementQty, M_Locator_ID, 
+                  M_AttributeSetInstance_ID, 
+                  M_Product_UOM_ID,
+                  QuantityOrder
+              ) VALUES (
+                  get_uuid(), CUR_BOM.M_ProductionPlan_ID, v_Line, CUR_BOM.Client_ID,
+                  CUR_BOM.Org_ID, 'Y', now(), p_User,
+                  now(), p_User, CUR_BOM.M_ProductBOM_ID, CUR_BOM.C_UOM_ID,
+                  -v_Qty, v_storage.M_Locator_ID, 
+                  (CASE WHEN (SELECT ATTRSETVALUETYPE FROM M_PRODUCT WHERE M_PRODUCT_ID=CUR_BOM.M_ProductBOM_ID)='F' THEN NULL ELSE v_storage.M_AttributeSetInstance_ID END), 
+                  v_storage.M_Product_UOM_ID,
+                  -v_QtyOrder
+              );
+              IF (v_QtyAcumulated >= CUR_BOM.ProductionQty*CUR_BOM.BOMQty) THEN
+                EXIT;
+              END IF;
+              v_QtyStorage:=0;
+              v_ResultStr:='FetchingData';
+              FETCH CUR_STOCK INTO v_storage;
+              IF (CUR_STOCK%NOTFOUND) THEN
+                CLOSE CUR_STOCK;
+                CUR_STOCK_ISOPEN:=false;
+                EXIT;
+              END IF;
+              EXIT WHEN CUR_STOCK%NOTFOUND;
+              v_QtyStorage:=v_storage.Qty;
             END LOOP;
-          END LOOP; -- While we have BOMs
-          -- Modifying locator to have sufficient stock
-          -- Indicate that it is Created
-          UPDATE M_PRODUCTION  SET IsCreated='Y',Updated=now(),UpdatedBy=p_User  WHERE M_Production_ID=v_Record_ID;
-          /**************************************************************************
-          * Post Lines
-          */
+          END IF; --NEXT_PRODUCT
         ELSE
-          v_ResultStr:='CheckingRestrictions';
-          SELECT COUNT(*)
-          INTO v_Count
-          FROM M_PRODUCTIONPLAN PP,
-            M_PRODUCTIONLINE PL,
-            M_PRODUCT P
-          WHERE PL.M_PRODUCT_ID=P.M_PRODUCT_ID
-            AND P.M_ATTRIBUTESET_ID IS NOT NULL
-            AND (P.ATTRSETVALUETYPE IS NULL OR P.ATTRSETVALUETYPE <> 'F')
-            AND (SELECT ISONEATTRSETVALREQUIRED FROM M_ATTRIBUTESET WHERE M_ATTRIBUTESET_ID = P.M_ATTRIBUTESET_ID) = 'Y'
-            AND COALESCE(PL.M_ATTRIBUTESETINSTANCE_ID, '0') = '0'
-            AND PL.M_ProductionPlan_ID=pp.M_ProductionPlan_ID
-            AND pp.M_Production_ID=v_Record_ID;
-          IF v_Count<>0 THEN
-          SELECT max(P.name) INTO v_Product_Name          
-          FROM M_PRODUCTIONPLAN PP,
-            M_PRODUCTIONLINE PL,
-            M_PRODUCT P
-          WHERE PL.M_PRODUCT_ID=P.M_PRODUCT_ID
-            AND P.M_ATTRIBUTESET_ID IS NOT NULL
-            AND (P.ATTRSETVALUETYPE IS NULL OR P.ATTRSETVALUETYPE <> 'F')
-            AND (SELECT ISONEATTRSETVALREQUIRED FROM M_ATTRIBUTESET WHERE M_ATTRIBUTESET_ID = P.M_ATTRIBUTESET_ID) = 'Y'
-            AND COALESCE(PL.M_ATTRIBUTESETINSTANCE_ID, '0') = '0'
-            AND PL.M_ProductionPlan_ID=pp.M_ProductionPlan_ID
-            AND pp.M_Production_ID=v_Record_ID;
-            v_Message:='@Product@'||' "' ||v_Product_Name ||'" ' || '@ProductWithoutAttributeSet@';
-            RAISE_APPLICATION_ERROR(-20000, v_Message);
-            FINISH_PROCESS:=true;
-          END IF;
-          -- All Production Lines
-          IF(NOT FINISH_PROCESS) THEN
-            FOR CUR_PL_Post IN
-              (SELECT pl.M_ProductionLine_ID,
-                pl.AD_Client_ID,
-                pl.AD_Org_ID,
-                p.MovementDate,
-                pl.M_Product_ID,
-                pl.M_AttributeSetInstance_ID,
-                pl.MovementQty,
-                pl.M_Locator_ID,
-                pl.M_Product_UOM_ID,
-                pl.QuantityOrder,
-                pl.C_UOM_ID,
-                pl.LINE
-              FROM M_PRODUCTION p,
-                M_PRODUCTIONLINE pl,
-                M_PRODUCTIONPLAN pp
-              WHERE p.M_Production_ID=pp.M_Production_ID
-                AND pp.M_ProductionPlan_ID=pl.M_ProductionPlan_ID
-                AND pp.M_Production_ID=v_Record_ID
-              ORDER BY pp.Line,
-                pl.Line
-              )
-            LOOP
-              -- M_ProductionLine_ID, AD_Client_ID, AD_Org_ID, MovementDate, M_Product_ID, MovementQty, M_Locator_ID
-              -- DBMS_OUTPUT.PUT_LINE('ProductionLine=' || pl.M_ProductionLine_ID);
-              -- DBMS_OUTPUT.PUT_LINE('  Qty=' || pl.MovementQty || ', OnHand=' || M_BOM_Qty_OnHand(pl.M_Product_ID, NULL, pl.M_Locator_ID));
-              -- Check Stock levels for reductions
-              IF(CUR_PL_Post.MovementQty<0 AND MustBeStocked<>'N'  AND M_BOM_Qty_OnHand(CUR_PL_Post.M_Product_ID, NULL, CUR_PL_Post.M_Locator_ID) +CUR_PL_Post.MovementQty<0) THEN
-                ROLLBACK;
-                SELECT '@NotEnoughStocked@: ' || Name
-                INTO v_Message
-                FROM M_PRODUCT
-                WHERE M_Product_ID=CUR_PL_Post.M_Product_ID;
-                RAISE_APPLICATION_ERROR(-20000, v_Message);
-                FINISH_PROCESS:=true;
-              END IF;
-              IF(NOT FINISH_PROCESS) THEN
-                -- Create Transaction Entry
-                v_ResultStr:='CreateTransaction';
-                Ad_Sequence_Next('M_Transaction', CUR_PL_Post.AD_Org_ID, NextNo) ;
-                INSERT
-                INTO M_TRANSACTION
-                  (
-                    M_Transaction_ID, M_ProductionLine_ID, AD_Client_ID, AD_Org_ID,
-                    IsActive, Created, CreatedBy, Updated,
-                    UpdatedBy, MovementType, M_Locator_ID, M_Product_ID,
-                    M_AttributeSetInstance_ID,
-                    MovementDate, MovementQty, M_Product_UOM_ID, QuantityOrder,
-                    C_UOM_ID
-                  )
-                  VALUES
-                  (
-                    NextNo, CUR_PL_Post.M_ProductionLine_ID, CUR_PL_Post.AD_Client_ID, CUR_PL_Post.AD_Org_ID,
-                     'Y', now(), p_User, now(),
-                    p_User, 'P+', CUR_PL_Post.M_Locator_ID, CUR_PL_Post.M_Product_ID,
-                    COALESCE(CUR_PL_Post.M_AttributeSetInstance_ID, '0'), -- not distinguishing between assemby/disassembly
-                    CUR_PL_Post.MovementDate, CUR_PL_Post.MovementQty, CUR_PL_Post.M_Product_UOM_ID, CUR_PL_Post.QuantityOrder,
-                    CUR_PL_Post.C_UOM_ID
-                  )
-                  ;
-                M_Check_Stock(CUR_PL_Post.M_Product_ID, v_Client_ID, v_Org_ID, v_Result, v_Message) ;
-                IF v_Result=0 THEN
-                  v_Message:=v_Message || ' @Inline@ ' || CUR_PL_Post.line;
-                  RAISE_APPLICATION_ERROR(-20000, v_Message);
-                  FINISH_PROCESS:=true;
-                END IF;
-              END IF; --FINISH_PROCESS
-            END LOOP;
-          END IF;--FINISH_PROCESS
-          IF(NOT FINISH_PROCESS) THEN
-            -- Indicate that we are done
-            UPDATE M_PRODUCTION
-              SET Processed='Y',
-              updated=now(),
-              updatedby=p_User
-            WHERE M_Production_ID=v_Record_ID;
-          END IF; --FINISH_PROCESS
+          SELECT COALESCE(MAX(Line), 0) + 10
+          INTO v_Line
+          FROM M_PRODUCTIONLINE
+          WHERE M_ProductionPlan_ID=CUR_BOM.M_ProductionPlan_ID;
+          INSERT INTO M_PRODUCTIONLINE (
+              M_ProductionLine_ID, M_ProductionPlan_ID, Line, AD_Client_ID,
+              AD_Org_ID, IsActive, Created, CreatedBy,
+              Updated, UpdatedBy, M_Product_ID, MovementQty,
+              M_Locator_ID, C_UOM_ID
+          ) VALUES (
+              get_uuid(), CUR_BOM.M_ProductionPlan_ID, v_Line, CUR_BOM.Client_ID,
+              CUR_BOM.Org_ID, 'Y', now(), p_User,
+              now(), p_User, CUR_BOM.M_ProductBOM_ID, -CUR_BOM.ProductionQty*CUR_BOM.BOMQty,
+              CUR_BOM.M_Locator_ID, CUR_BOM.C_UOM_ID
+          );
         END IF;
-      END IF;--FINISH_PROCESS
-      IF(NOT FINISH_PROCESS) THEN
-        -- Only commit when entire job successful
-        COMMIT;
-      END IF; --FINISH_PROCESS
-      --<<FINISH_PROCESS>>
-      --  Update AD_PInstance
-      DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
-      AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', v_Result, v_Message) ;
-      RETURN;
-    END; --BODY
+        --<<NEXT_PRODUCT>>
+        NEXT_PRODUCT:=false;
+        v_Line:=v_Line;
+        IF (v_QtyAcumulated < CUR_BOM.BOMQTY*CUR_BOM.ProductionQty) AND MustBeStocked='Y' THEN
+          v_Message := '@NotEnoughStocked@: ' || CUR_BOM.pname || ' ' || v_QtyAcumulated || ' / '|| CUR_BOM.BOMQTY*CUR_BOM.ProductionQty;
+          RAISE_APPLICATION_ERROR(-20000, v_Message);
+        END IF;
+        IF (CUR_BOM.ProductionQty <= 0) THEN
+          v_Message := '@NegativeBOMProductionQty@';
+          RAISE_APPLICATION_ERROR(-20000, v_Message);
+        END IF;
+      END LOOP;
+      IF (CUR_STOCK_ISOPEN) THEN
+        CLOSE CUR_STOCK;
+        CUR_STOCK_ISOPEN := false;
+      END IF;
+    END; --END OF DECLARE FOR BOM PRODUCTS INSERTION
+    -- While we have BOMs
+    LOOP
+      -- Are there non-stored BOMs to list details:8
+      v_ResultStr:='CreatingLine CheckBOM';
+      SELECT COUNT(*) INTO v_count
+      FROM M_PRODUCTIONLINE pl,
+        M_PRODUCT p,
+        M_PRODUCTIONPLAN pp
+      WHERE pl.M_Product_ID=p.M_Product_ID
+        AND pl.M_ProductionPlan_ID=pp.M_ProductionPlan_ID
+        AND pp.M_PRODUCTION_ID=v_Record_ID
+        AND pl.Line<>10 -- Origin Line
+        AND p.IsBOM='Y'
+        AND p.IsStocked='N';
+      -- Nothing to do
+      EXIT WHEN(v_count=0) ;
+      --
+      -- Resolve BOMs in ProductLine which are not stocked
+      FOR CUR_PLineBOM IN (
+          SELECT pl.M_ProductionLine_ID, pl.Line, pl.M_Product_ID, pl.MovementQty,
+              pp.M_LOCATOR_ID, pp.AD_Org_ID AS ORG_ID, pp.ProductionQty, pp.M_ProductionPlan_ID,
+              pp.AD_Client_ID AS Client_ID
+          FROM M_PRODUCTIONLINE pl, M_PRODUCT p, M_PRODUCTIONPLAN pp
+        WHERE pl.M_ProductionPlan_ID=pp.M_ProductionPlan_ID
+          AND pp.M_Production_ID=v_Record_ID
+          AND pl.M_Product_ID=p.M_Product_ID
+          AND pl.Line<>10 -- Origin Line
+          AND p.IsBOM='Y'
+          AND p.IsStocked='N'
+      ) LOOP
+        v_ResultStr:='CreatingLineBOM Resolution';
+        v_Line:=CUR_PLineBOM.Line;
+        -- Resolve BOM Line in product line
+        FOR CUR_BOM_PRODUCT IN (
+            SELECT pb.*, p.C_UOM_ID, p.IsStocked
+            FROM M_PRODUCT_BOM pb, M_PRODUCT p
+            WHERE pb.M_ProductBOM_ID=p.M_Product_ID
+              AND pb.M_Product_ID=CUR_PLineBOM.M_Product_ID
+              AND pb.isactive='Y'
+            ORDER BY pb.M_PRODUCTBOM_ID, pb.Line
+        ) LOOP
+          v_ResultStr:='CreatingLine Products2';
+          SELECT COALESCE(MAX(Line), 0) + 10 INTO v_Line
+          FROM M_PRODUCTIONLINE
+          WHERE M_ProductionPlan_ID=CUR_PLineBOM.M_ProductionPlan_ID;
+          INSERT INTO M_PRODUCTIONLINE (
+              M_ProductionLine_ID, M_ProductionPlan_ID, Line, AD_Client_ID,
+              AD_Org_ID, IsActive, Created, CreatedBy,
+              Updated, UpdatedBy, M_Product_ID, MovementQty,
+              M_Locator_ID, C_UOM_ID
+          ) VALUES (
+              get_uuid(), CUR_PLineBOM.M_ProductionPlan_ID, v_Line, CUR_PLineBOM.Client_ID,
+              CUR_PLineBOM.Org_ID, 'Y', now(), p_User,
+              now(), p_User, CUR_BOM_PRODUCT.M_ProductBOM_ID, CUR_PLineBOM.MovementQty*CUR_BOM_PRODUCT.BOMQty,
+              CUR_PLineBOM.M_Locator_ID, CUR_BOM_PRODUCT.C_UOM_ID
+          );
+        END LOOP;
+        -- Delete BOM line
+        DELETE
+        FROM M_PRODUCTIONLINE
+        WHERE M_ProductionLine_ID=CUR_PLineBOM.M_ProductionLine_ID;
+      END LOOP;
+    END LOOP; -- While we have BOMs
+    -- Modifying locator to have sufficient stock
+    -- Indicate that it is Created
+    UPDATE M_PRODUCTION  SET IsCreated='Y',Updated=now(),UpdatedBy=p_User  WHERE M_Production_ID=v_Record_ID;
+  /**************************************************************************
+  * Post Lines
+  */
+  ELSE
+    v_ResultStr:='CheckingRestrictions';
+    SELECT COUNT(*) INTO v_Count
+    FROM M_PRODUCTIONPLAN PP, M_PRODUCTIONLINE PL, M_PRODUCT P
+    WHERE PL.M_PRODUCT_ID=P.M_PRODUCT_ID
+      AND P.M_ATTRIBUTESET_ID IS NOT NULL
+      AND (P.ATTRSETVALUETYPE IS NULL OR P.ATTRSETVALUETYPE <> 'F')
+      AND (SELECT ISONEATTRSETVALREQUIRED FROM M_ATTRIBUTESET WHERE M_ATTRIBUTESET_ID = P.M_ATTRIBUTESET_ID) = 'Y'
+      AND COALESCE(PL.M_ATTRIBUTESETINSTANCE_ID, '0') = '0'
+      AND PL.M_ProductionPlan_ID=pp.M_ProductionPlan_ID
+      AND pp.M_Production_ID=v_Record_ID;
+    IF (v_Count <> 0) THEN
+      SELECT max(P.name) INTO v_Product_Name
+      FROM M_PRODUCTIONPLAN PP, M_PRODUCTIONLINE PL, M_PRODUCT P
+      WHERE PL.M_PRODUCT_ID=P.M_PRODUCT_ID
+        AND P.M_ATTRIBUTESET_ID IS NOT NULL
+        AND (P.ATTRSETVALUETYPE IS NULL OR P.ATTRSETVALUETYPE <> 'F')
+        AND (SELECT ISONEATTRSETVALREQUIRED FROM M_ATTRIBUTESET WHERE M_ATTRIBUTESET_ID = P.M_ATTRIBUTESET_ID) = 'Y'
+        AND COALESCE(PL.M_ATTRIBUTESETINSTANCE_ID, '0') = '0'
+        AND PL.M_ProductionPlan_ID=pp.M_ProductionPlan_ID
+        AND pp.M_Production_ID=v_Record_ID;
+      v_Message:='@Product@'||' "' ||v_Product_Name ||'" ' || '@ProductWithoutAttributeSet@';
+      RAISE_APPLICATION_ERROR(-20000, v_Message);
+    END IF;
+    -- All Production Lines
+    FOR CUR_PL_Post IN (
+        SELECT pl.M_ProductionLine_ID, pl.AD_Client_ID, pl.AD_Org_ID, p.MovementDate,
+            pl.M_Product_ID, pl.M_AttributeSetInstance_ID, pl.MovementQty, pl.M_Locator_ID,
+            pl.M_Product_UOM_ID, pl.QuantityOrder, pl.C_UOM_ID, pl.LINE
+        FROM M_PRODUCTION p, M_PRODUCTIONLINE pl, M_PRODUCTIONPLAN pp
+        WHERE p.M_Production_ID=pp.M_Production_ID
+          AND pp.M_ProductionPlan_ID=pl.M_ProductionPlan_ID
+          AND pp.M_Production_ID=v_Record_ID
+        ORDER BY pp.Line, pl.Line
+    ) LOOP
+      -- M_ProductionLine_ID, AD_Client_ID, AD_Org_ID, MovementDate, M_Product_ID, MovementQty, M_Locator_ID
+      -- DBMS_OUTPUT.PUT_LINE('ProductionLine=' || pl.M_ProductionLine_ID);
+      -- DBMS_OUTPUT.PUT_LINE('  Qty=' || pl.MovementQty || ', OnHand=' || M_BOM_Qty_OnHand(pl.M_Product_ID, NULL, pl.M_Locator_ID));
+      -- Check Stock levels for reductions
+      IF (CUR_PL_Post.MovementQty<0 AND MustBeStocked<>'N' AND M_BOM_Qty_OnHand(CUR_PL_Post.M_Product_ID, NULL, CUR_PL_Post.M_Locator_ID) +CUR_PL_Post.MovementQty<0) THEN
+        SELECT '@NotEnoughStocked@: ' || Name INTO v_Message
+        FROM M_PRODUCT
+        WHERE M_Product_ID=CUR_PL_Post.M_Product_ID;
+        RAISE_APPLICATION_ERROR(-20000, v_Message);
+      END IF;
+      -- Create Transaction Entry
+      v_ResultStr:='CreateTransaction';
+      INSERT INTO M_TRANSACTION (
+          M_Transaction_ID, M_ProductionLine_ID, AD_Client_ID, AD_Org_ID,
+          IsActive, Created, CreatedBy, Updated,
+          UpdatedBy, MovementType, M_Locator_ID, M_Product_ID,
+          M_AttributeSetInstance_ID,
+          MovementDate, MovementQty, M_Product_UOM_ID, QuantityOrder,
+          C_UOM_ID
+      ) VALUES (
+          get_uuid(), CUR_PL_Post.M_ProductionLine_ID, CUR_PL_Post.AD_Client_ID, CUR_PL_Post.AD_Org_ID,
+           'Y', now(), p_User, now(),
+          p_User, 'P+', CUR_PL_Post.M_Locator_ID, CUR_PL_Post.M_Product_ID,
+          COALESCE(CUR_PL_Post.M_AttributeSetInstance_ID, '0'), -- not distinguishing between assemby/disassembly
+          CUR_PL_Post.MovementDate, CUR_PL_Post.MovementQty, CUR_PL_Post.M_Product_UOM_ID, CUR_PL_Post.QuantityOrder,
+          CUR_PL_Post.C_UOM_ID
+      );
+      M_Check_Stock(CUR_PL_Post.M_Product_ID, v_Client_ID, v_Org_ID, v_Result, v_Message) ;
+      IF (v_Result = 0) THEN
+        v_Message:=v_Message || ' @Inline@ ' || CUR_PL_Post.line;
+        RAISE_APPLICATION_ERROR(-20000, v_Message);
+      END IF;
+    END LOOP;
+    -- Indicate that we are done
+    UPDATE M_PRODUCTION
+    SET Processed='Y',
+        updated=now(),
+        updatedby=p_User
+    WHERE M_Production_ID=v_Record_ID;
+  END IF;
+  --<<FINISH_PROCESS>>
+  --  Update AD_PInstance
+  DBMS_OUTPUT.PUT_LINE('Updating PInstance - Finished ' || v_Message) ;
+  AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', v_Result, v_Message) ;
+  RETURN;
+END; --BODY
 EXCEPTION
   WHEN OTHERS THEN
     DBMS_OUTPUT.PUT_LINE(v_ResultStr) ;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_UNIQUEATTRIBUTE_RULE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_UNIQUEATTRIBUTE_RULE">
+    <function name="M_UNIQUEATTRIBUTE_RULE" type="NULL">
+      <parameter name="pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_warehouse_id" type="VARCHAR" mode="in">
+        <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
+* 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) 2012 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+  v_ResultStr VARCHAR2(2000):='';
+  v_Message VARCHAR2(2000):='';
+
+  TYPE RECORD IS REF CURSOR;
+  Cur_Parameter RECORD;
+  Cur_MStock    RECORD;
+
+  v_quantity NUMBER;
+  v_ProductID   VARCHAR2(32);
+  v_SelectedAttSetInstanceID VARCHAR2(32) ;
+  v_ProductName M_Product.NAME%TYPE;
+BEGIN
+
+  v_ResultStr:='ReadingParameters';
+  FOR Cur_Parameter IN (
+      SELECT i.record_id, p.parametername, p.p_string, p.p_number, p.p_date, i.createdby AS ad_user_id
+      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
+        AND p.parametername IN ('Quantity', 'M_Product_ID')
+      ORDER BY p.seqno
+  ) LOOP
+
+    IF (Cur_Parameter.ParameterName = 'Quantity') THEN
+      v_Quantity:=Cur_Parameter.P_Number;
+      DBMS_OUTPUT.PUT_LINE(' Quantity=' || v_Quantity);
+    ELSIF (Cur_Parameter.ParameterName = 'M_Product_ID') THEN
+      v_ProductID:=Cur_Parameter.P_String;
+      DBMS_OUTPUT.PUT_LINE(' M_Product_ID=' || v_ProductID);
+    ELSE
+      DBMS_OUTPUT.PUT_LINE('*** Unknown Parameter=' || Cur_Parameter.ParameterName) ;
+    END IF;
+  END LOOP; -- Get Parameter
+
+  DELETE FROM m_stock_proposed ms
+  WHERE ad_pinstance_id = pinstance_id
+    AND EXISTS (SELECT 1
+                FROM m_storage_detail t
+                WHERE t.m_storage_detail_id = ms.m_storage_detail_id
+                AND t.m_attributesetinstance_id = '0');
+  v_SelectedAttSetInstanceID := NULL;
+
+  FOR Cur_MStock IN (
+      SELECT A.m_attributesetinstance_id
+      FROM (
+        SELECT SUM(ms.quantity) AS qty, t.m_attributesetinstance_id, MIN(priority) AS priority
+        FROM m_stock_proposed ms
+             JOIN m_storage_detail t ON ms.m_storage_detail_id = t.m_storage_detail_id
+        WHERE ad_pinstance_id = pinstance_id
+        GROUP BY t.m_attributesetinstance_id
+        HAVING sum(ms.quantity) >= v_quantity
+        ) A
+      ORDER BY A.priority
+  ) LOOP
+    v_selectedattsetinstanceid := cur_mstock.m_attributesetinstance_id;
+    EXIT;
+  END LOOP;
+
+  DELETE FROM m_stock_proposed
+  WHERE m_stock_proposed_id IN (SELECT m_stock_proposed_id
+                                FROM m_stock_proposed ms
+                                    JOIN m_storage_detail sd ON ms.m_storage_detail_id = sd.m_storage_detail_id
+                                    JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
+                                WHERE ms.ad_pinstance_id = pinstance_id
+                                  AND sd.m_attributesetinstance_id <> COALESCE(v_selectedattsetinstanceid, '-1')
+                                  AND l.m_warehouse_id = p_warehouse_id);
+
+  IF (v_selectedattsetinstanceid IS NULL) THEN
+    SELECT name INTO v_productname
+    FROM m_product
+    WHERE m_product_id = v_productid;
+    v_Message := '@Product@: ' || v_productname ||'. @NotEnoughAttUniqueStock@';
+    AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 0, v_Message, 'N');
+    RETURN;
+  END IF;
+EXCEPTION
+WHEN OTHERS THEN
+  v_ResultStr:= '@ERROR=' || SQLERRM;
+  AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 0, v_ResultStr, 'N');
+  RETURN;
+END M_UNIQUEATTRIBUTE_RULE
+]]></body>
+    </function>
+  </database>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_UNIQUELOCATOR_RULE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,99 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_UNIQUELOCATOR_RULE">
+    <function name="M_UNIQUELOCATOR_RULE" type="NULL">
+      <parameter name="pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_warehouse_id" type="VARCHAR" mode="in">
+        <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
+* 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) 2012 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+  v_ResultStr VARCHAR2(2000):='';
+  v_Message VARCHAR2(2000):='';
+
+  TYPE RECORD IS REF CURSOR;
+  Cur_Parameter RECORD;
+  Cur_MStock    RECORD;
+
+  v_quantity NUMBER;
+  v_ProductID   VARCHAR2(32);
+  v_SelectedLocatorID VARCHAR2(32) ;
+  v_ProductName M_Product.NAME%TYPE;
+BEGIN
+
+  v_ResultStr:='ReadingParameters';
+  FOR Cur_Parameter IN (
+      SELECT i.record_id, p.parametername, p.p_string, p.p_number, p.p_date, i.createdby AS ad_user_id
+      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
+        AND p.parametername IN ('Quantity', 'M_Product_ID')
+      ORDER BY p.seqno
+  ) LOOP
+
+    IF (Cur_Parameter.ParameterName = 'Quantity') THEN
+      v_Quantity:=Cur_Parameter.P_Number;
+      DBMS_OUTPUT.PUT_LINE(' Quantity=' || v_Quantity);
+    ELSIF (Cur_Parameter.ParameterName = 'M_Product_ID') THEN
+      v_ProductID:=Cur_Parameter.P_String;
+      DBMS_OUTPUT.PUT_LINE(' M_Product_ID=' || v_ProductID);
+    END IF;
+  END LOOP; -- Get Parameter
+
+  FOR Cur_MStock IN (
+      SELECT sum(ms.quantity) AS qty, t.m_locator_id, MIN(priority) AS priority
+      FROM m_stock_proposed ms
+           JOIN m_storage_detail t ON ms.m_storage_detail_id = t.m_storage_detail_id
+           JOIN m_locator l ON t.m_locator_id = l.m_locator_id
+      WHERE ad_pinstance_id = pinstance_id
+        AND l.m_warehouse_id = p_warehouse_id
+      GROUP BY t.m_locator_id
+      HAVING sum(ms.quantity) >= v_quantity
+      ORDER BY MIN(ms.priority)
+  ) LOOP
+    v_selectedlocatorid := cur_mstock.m_locator_id;
+    EXIT;
+  END LOOP;
+
+  IF (v_selectedlocatorid IS NOT NULL) THEN
+    DELETE FROM m_stock_proposed
+    WHERE m_stock_proposed_id IN (SELECT m_stock_proposed_id
+                                  FROM m_stock_proposed ms
+                                      JOIN m_storage_detail sd ON ms.m_storage_detail_id = sd.m_storage_detail_id
+                                      JOIN m_locator l ON sd.m_locator_id = l.m_locator_id
+                                  WHERE ms.ad_pinstance_id = pinstance_id
+                                    AND sd.m_locator_id <> COALESCE(v_selectedlocatorid, '-1')
+                                    AND l.m_warehouse_id = p_warehouse_id);
+  ELSE
+    SELECT name INTO v_productname
+    FROM m_product
+    WHERE m_product_id = v_productid;
+    v_Message := '@Product@: ' || v_productname ||'. @NotEnoughLocatorUniqueStock@';
+    AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 2, v_Message, 'N');
+    RETURN;
+  END IF;
+
+EXCEPTION
+WHEN OTHERS THEN
+  v_ResultStr:= '@ERROR=' || SQLERRM;
+  AD_UPDATE_PINSTANCE(PInstance_ID, NULL, 'N', 0, v_ResultStr, 'N');
+  RETURN;
+END M_UNIQUELOCATOR_RULE
+]]></body>
+    </function>
+  </database>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/functions/M_WAREHOUSE_DEFAULT_RULE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+  <database name="FUNCTION M_WAREHOUSE_DEFAULT_RULE">
+    <function name="M_WAREHOUSE_DEFAULT_RULE" type="NULL">
+      <parameter name="pinstance_id" type="VARCHAR" mode="in">
+        <default/>
+      </parameter>
+      <parameter name="p_warehouse_id" type="VARCHAR" mode="in">
+        <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
+* 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) 2012 Openbravo SLU
+* All Rights Reserved.
+* Contributor(s):  ______________________________________.
+************************************************************************/
+BEGIN
+  /*
+  
+  This rule keeps stock proposed as defaulted by the m_get_stock procedure. It shall be used when it is desired to
+  overwrite a warehouse rule defined at warehouse level.
+  
+  */
+  RETURN;
+END M_WAREHOUSE_DEFAULT_RULE
+]]></body>
+    </function>
+  </database>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/tables/AD_ORG_WAREHOUSE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+  <database name="TABLE AD_ORG_WAREHOUSE">
+    <table name="AD_ORG_WAREHOUSE" primaryKey="AD_ORG_WAREHOUSE_KEY">
+      <column name="AD_ORG_WAREHOUSE_ID" primaryKey="true" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="AD_CLIENT_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="AD_ORG_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="ISACTIVE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[Y]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="CREATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false">
+        <default><![CDATA[SYSDATE]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="CREATEDBY" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false">
+        <default><![CDATA[SYSDATE]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="UPDATEDBY" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="M_WAREHOUSE_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="PRIORITY" primaryKey="false" required="true" type="DECIMAL" autoIncrement="false">
+        <default><![CDATA[0]]></default>
+        <onCreateDefault/>
+      </column>
+      <foreign-key foreignTable="AD_CLIENT" name="AD_ORG_WAREHOUSE_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="AD_ORG_WAREHOUSE_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="M_WAREHOUSE" name="AD_ORG_WAREHOUSE_WAREHOUSE">
+        <reference local="M_WAREHOUSE_ID" foreign="M_WAREHOUSE_ID"/>
+      </foreign-key>
+      <check name="AD_ORG_WAREHOUSE_ACTIVE_CHK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+    </table>
+  </database>
--- a/src-db/database/model/tables/C_ORDERLINE.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/model/tables/C_ORDERLINE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -217,6 +217,10 @@
         <default><![CDATA[0]]></default>
         <onCreateDefault/>
       </column>
+      <column name="M_WAREHOUSE_RULE_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_CLIENT" name="C_ORDERLINE_AD_CLIENT">
         <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
       </foreign-key>
@@ -277,6 +281,9 @@
       <foreign-key foreignTable="C_ORDERLINE" name="C_ORDERLINE_SOPOREF">
         <reference local="REF_ORDERLINE_ID" foreign="C_ORDERLINE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_WAREHOUSE_RULE" name="C_ORDERLINE_WAREHOUSERULE">
+        <reference local="M_WAREHOUSE_RULE_ID" foreign="M_WAREHOUSE_RULE_ID"/>
+      </foreign-key>
       <index name="C_ORDERLINE_C_RETURN_REASON" unique="false">
         <index-column name="C_RETURN_REASON_ID"/>
       </index>
--- a/src-db/database/model/tables/MA_SEQUENCEPRODUCT.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/model/tables/MA_SEQUENCEPRODUCT.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -93,6 +93,10 @@
         <default><![CDATA[0]]></default>
         <onCreateDefault/>
       </column>
+      <column name="M_WAREHOUSE_RULE_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MASEQUENCEPRODUCT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
@@ -111,6 +115,9 @@
       <foreign-key foreignTable="MA_SEQUENCE" name="MA_SEQUENCEPRODUCT_MA_SEQUENCE">
         <reference local="MA_SEQUENCE_ID" foreign="MA_SEQUENCE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_WAREHOUSE_RULE" name="MA_SEQUENCERODUCT_WHRULE">
+        <reference local="M_WAREHOUSE_RULE_ID" foreign="M_WAREHOUSE_RULE_ID"/>
+      </foreign-key>
       <index name="MA_SEQ_PROD_SEQ_ID" unique="false">
         <index-column name="MA_SEQUENCE_ID"/>
       </index>
--- a/src-db/database/model/tables/MA_WRPHASEPRODUCT.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/model/tables/MA_WRPHASEPRODUCT.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -73,6 +73,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="M_WAREHOUSE_RULE_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="AD_ORG" name="AD_ORG_MAWRPHASEPRODUCT">
         <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
       </foreign-key>
@@ -94,6 +98,9 @@
       <foreign-key foreignTable="MA_WRPHASE" name="MA_WRPHASEPRODUCT_MA_WRPHASE">
         <reference local="MA_WRPHASE_ID" foreign="MA_WRPHASE_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_WAREHOUSE_RULE" name="MA_WRPPHASERODUCT_WHRULE">
+        <reference local="M_WAREHOUSE_RULE_ID" foreign="M_WAREHOUSE_RULE_ID"/>
+      </foreign-key>
       <index name="MA_WRPHASEPRODUCT_PROD_PHASE" unique="false">
         <index-column name="M_PRODUCT_ID"/>
         <index-column name="MA_WRPHASE_ID"/>
--- a/src-db/database/model/tables/M_WAREHOUSE.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/model/tables/M_WAREHOUSE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -73,6 +73,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="M_WAREHOUSE_RULE_ID" primaryKey="false" required="false" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
       <foreign-key foreignTable="C_LOCATION" name="C_LOCATION_WAREHOUSE">
         <reference local="C_LOCATION_ID" foreign="C_LOCATION_ID"/>
       </foreign-key>
@@ -85,6 +89,9 @@
       <foreign-key foreignTable="M_LOCATOR" name="M_WAREHOUSE_RETURNLOCATOR">
         <reference local="M_RETURNLOCATOR_ID" foreign="M_LOCATOR_ID"/>
       </foreign-key>
+      <foreign-key foreignTable="M_WAREHOUSE_RULE" name="M_WAREHOUSE_WHRULE">
+        <reference local="M_WAREHOUSE_RULE_ID" foreign="M_WAREHOUSE_RULE_ID"/>
+      </foreign-key>
       <unique name="M_WAREHOUSE_NAME">
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="NAME"/>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-db/database/model/tables/M_WAREHOUSE_RULE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,56 @@
+<?xml version="1.0"?>
+  <database name="TABLE M_WAREHOUSE_RULE">
+    <table name="M_WAREHOUSE_RULE" primaryKey="M_WAREHOUSE_RULE_KEY">
+      <column name="M_WAREHOUSE_RULE_ID" primaryKey="true" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="AD_CLIENT_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="AD_ORG_ID" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="ISACTIVE" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[Y]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="CREATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false">
+        <default><![CDATA[SYSDATE]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="CREATEDBY" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="UPDATED" primaryKey="false" required="true" type="TIMESTAMP" size="7" autoIncrement="false">
+        <default><![CDATA[SYSDATE]]></default>
+        <onCreateDefault/>
+      </column>
+      <column name="UPDATEDBY" primaryKey="false" required="true" type="VARCHAR" size="32" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="NAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="PROCEDURENAME" primaryKey="false" required="true" type="NVARCHAR" size="60" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <column name="DESCRIPTION" primaryKey="false" required="false" type="NVARCHAR" size="2000" autoIncrement="false">
+        <default/>
+        <onCreateDefault/>
+      </column>
+      <foreign-key foreignTable="AD_CLIENT" name="M_WAREHOUSE_RULE_CLIENT">
+        <reference local="AD_CLIENT_ID" foreign="AD_CLIENT_ID"/>
+      </foreign-key>
+      <foreign-key foreignTable="AD_ORG" name="M_WAREHOUSE_RULE_ORG">
+        <reference local="AD_ORG_ID" foreign="AD_ORG_ID"/>
+      </foreign-key>
+      <check name="M_WAREHOUSE_RULE_ACTIVE_CHK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
+    </table>
+  </database>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -287829,7 +287829,7 @@
 <!--B7D39D63B1734983ABB6829E13A6F46F-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--B7D39D63B1734983ABB6829E13A6F46F-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--B7D39D63B1734983ABB6829E13A6F46F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--B7D39D63B1734983ABB6829E13A6F46F-->  <POSITION><![CDATA[35]]></POSITION>
+<!--B7D39D63B1734983ABB6829E13A6F46F-->  <POSITION><![CDATA[22]]></POSITION>
 <!--B7D39D63B1734983ABB6829E13A6F46F-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--B7D39D63B1734983ABB6829E13A6F46F-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--B7D39D63B1734983ABB6829E13A6F46F-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -290200,7 +290200,7 @@
 <!--BBF2C9B6AA3B4989980411CAFB374A69-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--BBF2C9B6AA3B4989980411CAFB374A69-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--BBF2C9B6AA3B4989980411CAFB374A69-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--BBF2C9B6AA3B4989980411CAFB374A69-->  <POSITION><![CDATA[34]]></POSITION>
+<!--BBF2C9B6AA3B4989980411CAFB374A69-->  <POSITION><![CDATA[21]]></POSITION>
 <!--BBF2C9B6AA3B4989980411CAFB374A69-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--BBF2C9B6AA3B4989980411CAFB374A69-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--BBF2C9B6AA3B4989980411CAFB374A69-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
@@ -292197,6 +292197,363 @@
 <!--CB0FCC032C944B238FC720EEDD6061D2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--CB0FCC032C944B238FC720EEDD6061D2--></AD_COLUMN>
 
+<!--CB2739BEDFFDA0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEDFFDA0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <NAME><![CDATA[Organization Warehouse]]></NAME>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <HELP><![CDATA[Identifies a on hand warehouse of an Organization.]]></HELP>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[AD_Org_Warehouse_ID]]></COLUMNNAME>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[13]]></AD_REFERENCE_ID>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISKEY><![CDATA[Y]]></ISKEY>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[CB273E1D40847ADAE040007F010023DB]]></AD_ELEMENT_ID>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <POSITION><![CDATA[1]]></POSITION>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEDFFDA0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEDFFDA0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEDFFEA0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEDFFEA0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <NAME><![CDATA[Client]]></NAME>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[AD_Client_ID]]></COLUMNNAME>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <DEFAULTVALUE><![CDATA[@AD_CLIENT_ID@]]></DEFAULTVALUE>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[102]]></AD_ELEMENT_ID>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <POSITION><![CDATA[2]]></POSITION>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEDFFEA0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEDFFEA0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEDFFFA0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEDFFFA0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <NAME><![CDATA[Organization]]></NAME>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[AD_Org_ID]]></COLUMNNAME>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <DEFAULTVALUE><![CDATA[@AD_ORG_ID@]]></DEFAULTVALUE>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISPARENT><![CDATA[Y]]></ISPARENT>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[113]]></AD_ELEMENT_ID>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <POSITION><![CDATA[3]]></POSITION>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEDFFFA0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEDFFFA0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEE000A0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE000A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <NAME><![CDATA[Active]]></NAME>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[A flag indicating whether this record is available for use or de-activated.]]></DESCRIPTION>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <HELP><![CDATA[There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reporting. There are two reasons for de-activating and not deleting records: 
+(1) The system requires the record for auditing purposes.
+(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are existing invoices for it. By de-activating the Business Partner you prevent it from being used in future transactions.]]></HELP>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[Isactive]]></COLUMNNAME>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <DEFAULTVALUE><![CDATA[Y]]></DEFAULTVALUE>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[348]]></AD_ELEMENT_ID>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <POSITION><![CDATA[4]]></POSITION>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEE000A0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEE000A0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEE001A0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE001A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <NAME><![CDATA[Creation Date]]></NAME>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[The date that this record is completed.]]></DESCRIPTION>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <HELP><![CDATA[The Created field indicates the date that this record was created.]]></HELP>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[Created]]></COLUMNNAME>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[16]]></AD_REFERENCE_ID>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <DEFAULTVALUE><![CDATA[SYSDATE]]></DEFAULTVALUE>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[245]]></AD_ELEMENT_ID>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <POSITION><![CDATA[5]]></POSITION>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEE001A0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEE001A0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEE002A0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE002A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <NAME><![CDATA[Created By]]></NAME>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[User who created this records]]></DESCRIPTION>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <HELP><![CDATA[The Created By field indicates the user who created this record.]]></HELP>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[Createdby]]></COLUMNNAME>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[30]]></AD_REFERENCE_ID>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <SEQNO><![CDATA[60]]></SEQNO>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[246]]></AD_ELEMENT_ID>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <POSITION><![CDATA[6]]></POSITION>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEE002A0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEE002A0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEE003A0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE003A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <NAME><![CDATA[Updated]]></NAME>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[The date that this record was last updated]]></DESCRIPTION>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <HELP><![CDATA[The Updated field indicates the date that this record was updated.]]></HELP>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[Updated]]></COLUMNNAME>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[16]]></AD_REFERENCE_ID>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <DEFAULTVALUE><![CDATA[SYSDATE]]></DEFAULTVALUE>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <SEQNO><![CDATA[70]]></SEQNO>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[607]]></AD_ELEMENT_ID>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <POSITION><![CDATA[7]]></POSITION>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEE003A0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEE003A0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEE004A0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE004A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <NAME><![CDATA[Updated By]]></NAME>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[User who updated this records]]></DESCRIPTION>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <HELP><![CDATA[The Updated By field indicates the user who updated this record.]]></HELP>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[Updatedby]]></COLUMNNAME>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[30]]></AD_REFERENCE_ID>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <SEQNO><![CDATA[80]]></SEQNO>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[608]]></AD_ELEMENT_ID>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <POSITION><![CDATA[8]]></POSITION>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEE004A0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEE004A0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEE005A0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE005A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <NAME><![CDATA[Warehouse]]></NAME>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[The location where products arrive to or are sent from.]]></DESCRIPTION>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <HELP><![CDATA[The Warehouse identifies a unique Warehouse where products are stored or Services are provided.]]></HELP>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[M_Warehouse_ID]]></COLUMNNAME>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISPARENT><![CDATA[Y]]></ISPARENT>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <SEQNO><![CDATA[90]]></SEQNO>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[459]]></AD_ELEMENT_ID>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <POSITION><![CDATA[9]]></POSITION>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEE005A0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEE005A0E9E040007F010023A5--></AD_COLUMN>
+
+<!--CB2739BEE006A0E9E040007F010023A5--><AD_COLUMN>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE006A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <NAME><![CDATA[Priority]]></NAME>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[A defined level of importance or precedence.]]></DESCRIPTION>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <HELP><![CDATA[The Priority indicates the importance of this request.]]></HELP>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <COLUMNNAME><![CDATA[Priority]]></COLUMNNAME>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <AD_REFERENCE_ID><![CDATA[11]]></AD_REFERENCE_ID>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <FIELDLENGTH><![CDATA[12]]></FIELDLENGTH>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <DEFAULTVALUE><![CDATA[0]]></DEFAULTVALUE>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <SEQNO><![CDATA[100]]></SEQNO>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <AD_ELEMENT_ID><![CDATA[1514]]></AD_ELEMENT_ID>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <POSITION><![CDATA[10]]></POSITION>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB2739BEE006A0E9E040007F010023A5-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB2739BEE006A0E9E040007F010023A5--></AD_COLUMN>
+
 <!--CB3B154781F840CCA73D6656027F5595--><AD_COLUMN>
 <!--CB3B154781F840CCA73D6656027F5595-->  <AD_COLUMN_ID><![CDATA[CB3B154781F840CCA73D6656027F5595]]></AD_COLUMN_ID>
 <!--CB3B154781F840CCA73D6656027F5595-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -292232,6 +292589,533 @@
 <!--CB3B154781F840CCA73D6656027F5595-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--CB3B154781F840CCA73D6656027F5595--></AD_COLUMN>
 
+<!--CB8AA603D64552F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64552F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[M_Warehouse_Rule_ID]]></COLUMNNAME>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[13]]></AD_REFERENCE_ID>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISKEY><![CDATA[Y]]></ISKEY>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[CB8AD3FC3535A9FCE040007F01002CB2]]></AD_ELEMENT_ID>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <POSITION><![CDATA[1]]></POSITION>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64552F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64552F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D64652F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64652F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <NAME><![CDATA[Client]]></NAME>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[AD_Client_ID]]></COLUMNNAME>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <DEFAULTVALUE><![CDATA[@AD_CLIENT_ID@]]></DEFAULTVALUE>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[102]]></AD_ELEMENT_ID>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <POSITION><![CDATA[2]]></POSITION>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64652F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64652F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D64752F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64752F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <NAME><![CDATA[Organization]]></NAME>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[AD_Org_ID]]></COLUMNNAME>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <DEFAULTVALUE><![CDATA[@AD_ORG_ID@]]></DEFAULTVALUE>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[113]]></AD_ELEMENT_ID>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[Y]]></ISSESSIONATTR>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <POSITION><![CDATA[3]]></POSITION>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64752F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64752F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D64852F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64852F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <NAME><![CDATA[Active]]></NAME>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[A flag indicating whether this record is available for use or de-activated.]]></DESCRIPTION>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <HELP><![CDATA[There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reporting. There are two reasons for de-activating and not deleting records: 
+(1) The system requires the record for auditing purposes.
+(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are existing invoices for it. By de-activating the Business Partner you prevent it from being used in future transactions.]]></HELP>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[Isactive]]></COLUMNNAME>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <DEFAULTVALUE><![CDATA[Y]]></DEFAULTVALUE>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[348]]></AD_ELEMENT_ID>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <POSITION><![CDATA[4]]></POSITION>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64852F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64852F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D64952F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64952F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <NAME><![CDATA[Creation Date]]></NAME>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[The date that this record is completed.]]></DESCRIPTION>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <HELP><![CDATA[The Created field indicates the date that this record was created.]]></HELP>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[Created]]></COLUMNNAME>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[16]]></AD_REFERENCE_ID>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <DEFAULTVALUE><![CDATA[SYSDATE]]></DEFAULTVALUE>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <SEQNO><![CDATA[50]]></SEQNO>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[245]]></AD_ELEMENT_ID>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <POSITION><![CDATA[5]]></POSITION>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64952F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64952F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D64A52F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64A52F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <NAME><![CDATA[Created By]]></NAME>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[User who created this records]]></DESCRIPTION>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <HELP><![CDATA[The Created By field indicates the user who created this record.]]></HELP>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[Createdby]]></COLUMNNAME>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[30]]></AD_REFERENCE_ID>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <SEQNO><![CDATA[60]]></SEQNO>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[246]]></AD_ELEMENT_ID>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <POSITION><![CDATA[6]]></POSITION>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64A52F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64A52F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D64B52F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64B52F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <NAME><![CDATA[Updated]]></NAME>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[The date that this record was last updated]]></DESCRIPTION>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <HELP><![CDATA[The Updated field indicates the date that this record was updated.]]></HELP>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[Updated]]></COLUMNNAME>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[16]]></AD_REFERENCE_ID>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[19]]></FIELDLENGTH>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <DEFAULTVALUE><![CDATA[SYSDATE]]></DEFAULTVALUE>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <SEQNO><![CDATA[70]]></SEQNO>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[607]]></AD_ELEMENT_ID>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <POSITION><![CDATA[7]]></POSITION>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64B52F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64B52F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D64C52F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64C52F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <NAME><![CDATA[Updated By]]></NAME>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[User who updated this records]]></DESCRIPTION>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <HELP><![CDATA[The Updated By field indicates the user who updated this record.]]></HELP>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[Updatedby]]></COLUMNNAME>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[30]]></AD_REFERENCE_ID>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <SEQNO><![CDATA[80]]></SEQNO>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[608]]></AD_ELEMENT_ID>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <POSITION><![CDATA[8]]></POSITION>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64C52F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64C52F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D64D52F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64D52F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <NAME><![CDATA[Name]]></NAME>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[A non-unique identifier for a record/document often used as a search tool.]]></DESCRIPTION>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <HELP><![CDATA[A more descriptive identifier (that does need to be unique) of a record/document that is used as a default search option along with the search key (that is unique and mostly shorter). It is up to 60 characters in length.]]></HELP>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[Name]]></COLUMNNAME>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[Y]]></ISIDENTIFIER>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <SEQNO><![CDATA[90]]></SEQNO>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[469]]></AD_ELEMENT_ID>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <POSITION><![CDATA[9]]></POSITION>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D64D52F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D64D52F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB8AA603D65152F6E040007F01002AD2--><AD_COLUMN>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <AD_COLUMN_ID><![CDATA[CB8AA603D65152F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <NAME><![CDATA[Procedure]]></NAME>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <DESCRIPTION><![CDATA[Name of the Database Procedure]]></DESCRIPTION>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <HELP><![CDATA[The Procedure indicates the name of the database procedure called by this report or process.]]></HELP>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <COLUMNNAME><![CDATA[Procedurename]]></COLUMNNAME>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <AD_REFERENCE_ID><![CDATA[10]]></AD_REFERENCE_ID>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <FIELDLENGTH><![CDATA[60]]></FIELDLENGTH>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISUPDATEABLE><![CDATA[N]]></ISUPDATEABLE>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <SEQNO><![CDATA[110]]></SEQNO>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <AD_ELEMENT_ID><![CDATA[998]]></AD_ELEMENT_ID>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <POSITION><![CDATA[11]]></POSITION>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB8AA603D65152F6E040007F01002AD2-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB8AA603D65152F6E040007F01002AD2--></AD_COLUMN>
+
+<!--CB9E2FD2CC03DE61E040007F010001E1--><AD_COLUMN>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <AD_COLUMN_ID><![CDATA[CB9E2FD2CC03DE61E040007F010001E1]]></AD_COLUMN_ID>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <COLUMNNAME><![CDATA[M_Warehouse_Rule_ID]]></COLUMNNAME>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <AD_TABLE_ID><![CDATA[800100]]></AD_TABLE_ID>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <SEQNO><![CDATA[230]]></SEQNO>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <AD_ELEMENT_ID><![CDATA[CB8AD3FC3535A9FCE040007F01002CB2]]></AD_ELEMENT_ID>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <POSITION><![CDATA[19]]></POSITION>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB9E2FD2CC03DE61E040007F010001E1-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB9E2FD2CC03DE61E040007F010001E1--></AD_COLUMN>
+
+<!--CB9E2FD2CC3EDE61E040007F010001E1--><AD_COLUMN>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <AD_COLUMN_ID><![CDATA[CB9E2FD2CC3EDE61E040007F010001E1]]></AD_COLUMN_ID>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <NAME><![CDATA[Description]]></NAME>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <DESCRIPTION><![CDATA[A space to write additional related information.]]></DESCRIPTION>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <HELP><![CDATA[A description is limited to 255 characters.]]></HELP>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <COLUMNNAME><![CDATA[Description]]></COLUMNNAME>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <AD_REFERENCE_ID><![CDATA[14]]></AD_REFERENCE_ID>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <FIELDLENGTH><![CDATA[2000]]></FIELDLENGTH>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <SEQNO><![CDATA[140]]></SEQNO>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <AD_ELEMENT_ID><![CDATA[275]]></AD_ELEMENT_ID>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <POSITION><![CDATA[13]]></POSITION>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB9E2FD2CC3EDE61E040007F010001E1-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB9E2FD2CC3EDE61E040007F010001E1--></AD_COLUMN>
+
+<!--CB9E308EE8BFDCBAE040007F010001E7--><AD_COLUMN>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <AD_COLUMN_ID><![CDATA[CB9E308EE8BFDCBAE040007F010001E7]]></AD_COLUMN_ID>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <COLUMNNAME><![CDATA[M_Warehouse_Rule_ID]]></COLUMNNAME>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <AD_TABLE_ID><![CDATA[190]]></AD_TABLE_ID>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <SEQNO><![CDATA[61]]></SEQNO>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <AD_ELEMENT_ID><![CDATA[CB8AD3FC3535A9FCE040007F01002CB2]]></AD_ELEMENT_ID>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <POSITION><![CDATA[19]]></POSITION>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB9E308EE8BFDCBAE040007F010001E7-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB9E308EE8BFDCBAE040007F010001E7--></AD_COLUMN>
+
+<!--CB9E308EE8DFDCBAE040007F010001E7--><AD_COLUMN>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <AD_COLUMN_ID><![CDATA[CB9E308EE8DFDCBAE040007F010001E7]]></AD_COLUMN_ID>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <COLUMNNAME><![CDATA[M_Warehouse_Rule_ID]]></COLUMNNAME>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <AD_TABLE_ID><![CDATA[260]]></AD_TABLE_ID>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <SEQNO><![CDATA[144]]></SEQNO>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <AD_ELEMENT_ID><![CDATA[CB8AD3FC3535A9FCE040007F01002CB2]]></AD_ELEMENT_ID>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <POSITION><![CDATA[54]]></POSITION>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB9E308EE8DFDCBAE040007F010001E7-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB9E308EE8DFDCBAE040007F010001E7--></AD_COLUMN>
+
+<!--CB9E32CCC77F256DE040007F010001D6--><AD_COLUMN>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <AD_COLUMN_ID><![CDATA[CB9E32CCC77F256DE040007F010001D6]]></AD_COLUMN_ID>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <COLUMNNAME><![CDATA[M_Warehouse_Rule_ID]]></COLUMNNAME>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <AD_TABLE_ID><![CDATA[800097]]></AD_TABLE_ID>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <AD_REFERENCE_ID><![CDATA[19]]></AD_REFERENCE_ID>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <FIELDLENGTH><![CDATA[32]]></FIELDLENGTH>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISMANDATORY><![CDATA[N]]></ISMANDATORY>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <SEQNO><![CDATA[360]]></SEQNO>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <AD_ELEMENT_ID><![CDATA[CB8AD3FC3535A9FCE040007F01002CB2]]></AD_ELEMENT_ID>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <POSITION><![CDATA[24]]></POSITION>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--CB9E32CCC77F256DE040007F010001D6-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--CB9E32CCC77F256DE040007F010001D6--></AD_COLUMN>
+
 <!--CC3F4812548548AE9E1E8D0FCD8269DF--><AD_COLUMN>
 <!--CC3F4812548548AE9E1E8D0FCD8269DF-->  <AD_COLUMN_ID><![CDATA[CC3F4812548548AE9E1E8D0FCD8269DF]]></AD_COLUMN_ID>
 <!--CC3F4812548548AE9E1E8D0FCD8269DF-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -294902,7 +295786,7 @@
 <!--ECD90C86634B4A51B2FFCE7248293BED-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
 <!--ECD90C86634B4A51B2FFCE7248293BED-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
 <!--ECD90C86634B4A51B2FFCE7248293BED-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
-<!--ECD90C86634B4A51B2FFCE7248293BED-->  <POSITION><![CDATA[36]]></POSITION>
+<!--ECD90C86634B4A51B2FFCE7248293BED-->  <POSITION><![CDATA[23]]></POSITION>
 <!--ECD90C86634B4A51B2FFCE7248293BED-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
 <!--ECD90C86634B4A51B2FFCE7248293BED-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
 <!--ECD90C86634B4A51B2FFCE7248293BED-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
--- a/src-db/database/sourcedata/AD_DATASET.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_DATASET.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -58,6 +58,21 @@
 <!--4F7351B72C1E40E8AF23B8C49C386339-->  <SEQNO><![CDATA[10]]></SEQNO>
 <!--4F7351B72C1E40E8AF23B8C49C386339--></AD_DATASET>
 
+<!--52C0F6734D1C4CE68C091526984B6C87--><AD_DATASET>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <AD_DATASET_ID><![CDATA[52C0F6734D1C4CE68C091526984B6C87]]></AD_DATASET_ID>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <VALUE><![CDATA[WarehouseRules]]></VALUE>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <NAME><![CDATA[Core Warehouse Rules]]></NAME>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <EXPORT><![CDATA[N]]></EXPORT>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <ACCESSLEVEL><![CDATA[6]]></ACCESSLEVEL>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <EXPORTALLOWED><![CDATA[Y]]></EXPORTALLOWED>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <CHECKSUM><![CDATA[45186928065247714328207251939202646850]]></CHECKSUM>
+<!--52C0F6734D1C4CE68C091526984B6C87-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--52C0F6734D1C4CE68C091526984B6C87--></AD_DATASET>
+
 <!--575BE80AA7864187966A3FCFA1B1854D--><AD_DATASET>
 <!--575BE80AA7864187966A3FCFA1B1854D-->  <AD_DATASET_ID><![CDATA[575BE80AA7864187966A3FCFA1B1854D]]></AD_DATASET_ID>
 <!--575BE80AA7864187966A3FCFA1B1854D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -98,7 +113,7 @@
 <!--F06A92EB45C5487EAE20C7A864DBDE04-->  <EXPORT><![CDATA[N]]></EXPORT>
 <!--F06A92EB45C5487EAE20C7A864DBDE04-->  <ACCESSLEVEL><![CDATA[6]]></ACCESSLEVEL>
 <!--F06A92EB45C5487EAE20C7A864DBDE04-->  <EXPORTALLOWED><![CDATA[Y]]></EXPORTALLOWED>
-<!--F06A92EB45C5487EAE20C7A864DBDE04-->  <CHECKSUM><![CDATA[103659316938494998110139143062286499557]]></CHECKSUM>
+<!--F06A92EB45C5487EAE20C7A864DBDE04-->  <CHECKSUM><![CDATA[281949768489412648962353822266799178366]]></CHECKSUM>
 <!--F06A92EB45C5487EAE20C7A864DBDE04-->  <SEQNO><![CDATA[20]]></SEQNO>
 <!--F06A92EB45C5487EAE20C7A864DBDE04--></AD_DATASET>
 
--- a/src-db/database/sourcedata/AD_DATASET_TABLE.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_DATASET_TABLE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -6229,6 +6229,20 @@
 <!--F6B8C8566CB54FC9830B496BB7974E83-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--F6B8C8566CB54FC9830B496BB7974E83--></AD_DATASET_TABLE>
 
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382--><AD_DATASET_TABLE>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <AD_DATASET_TABLE_ID><![CDATA[F89564ED2D4C4E9E8EDD69A9E67FC382]]></AD_DATASET_TABLE_ID>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <AD_DATASET_ID><![CDATA[52C0F6734D1C4CE68C091526984B6C87]]></AD_DATASET_ID>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <INCLUDEALLCOLUMNS><![CDATA[Y]]></INCLUDEALLCOLUMNS>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <WHERECLAUSE><![CDATA[exists (select 1 from ModuleDBPrefix where module.id = '0' and lower(procedurename) like lower(name||'%'))]]></WHERECLAUSE>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <EXCLUDEAUDITINFO><![CDATA[Y]]></EXCLUDEAUDITINFO>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <ISBUSINESSOBJECT><![CDATA[N]]></ISBUSINESSOBJECT>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--F89564ED2D4C4E9E8EDD69A9E67FC382--></AD_DATASET_TABLE>
+
 <!--FC362A8896DB11AD8E97081B388C61A4--><AD_DATASET_TABLE>
 <!--FC362A8896DB11AD8E97081B388C61A4-->  <AD_DATASET_TABLE_ID><![CDATA[FC362A8896DB11AD8E97081B388C61A4]]></AD_DATASET_TABLE_ID>
 <!--FC362A8896DB11AD8E97081B388C61A4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_ELEMENT.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -29140,6 +29140,19 @@
 <!--CA10792A63BB4C1CBD5346A823DFE538-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--CA10792A63BB4C1CBD5346A823DFE538--></AD_ELEMENT>
 
+<!--CB273E1D40847ADAE040007F010023DB--><AD_ELEMENT>
+<!--CB273E1D40847ADAE040007F010023DB-->  <AD_ELEMENT_ID><![CDATA[CB273E1D40847ADAE040007F010023DB]]></AD_ELEMENT_ID>
+<!--CB273E1D40847ADAE040007F010023DB-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB273E1D40847ADAE040007F010023DB-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB273E1D40847ADAE040007F010023DB-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB273E1D40847ADAE040007F010023DB-->  <COLUMNNAME><![CDATA[AD_Org_Warehouse_ID]]></COLUMNNAME>
+<!--CB273E1D40847ADAE040007F010023DB-->  <NAME><![CDATA[Organization Warehouse]]></NAME>
+<!--CB273E1D40847ADAE040007F010023DB-->  <PRINTNAME><![CDATA[Organization Warehouse]]></PRINTNAME>
+<!--CB273E1D40847ADAE040007F010023DB-->  <HELP><![CDATA[Identifies a on hand warehouse of an Organization.]]></HELP>
+<!--CB273E1D40847ADAE040007F010023DB-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB273E1D40847ADAE040007F010023DB-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--CB273E1D40847ADAE040007F010023DB--></AD_ELEMENT>
+
 <!--CB65CBB36988405DA4D2F2C36CD29DC4--><AD_ELEMENT>
 <!--CB65CBB36988405DA4D2F2C36CD29DC4-->  <AD_ELEMENT_ID><![CDATA[CB65CBB36988405DA4D2F2C36CD29DC4]]></AD_ELEMENT_ID>
 <!--CB65CBB36988405DA4D2F2C36CD29DC4-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -29154,6 +29167,19 @@
 <!--CB65CBB36988405DA4D2F2C36CD29DC4-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
 <!--CB65CBB36988405DA4D2F2C36CD29DC4--></AD_ELEMENT>
 
+<!--CB8AD3FC3535A9FCE040007F01002CB2--><AD_ELEMENT>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <AD_ELEMENT_ID><![CDATA[CB8AD3FC3535A9FCE040007F01002CB2]]></AD_ELEMENT_ID>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <COLUMNNAME><![CDATA[M_Warehouse_Rule_ID]]></COLUMNNAME>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <PRINTNAME><![CDATA[Warehouse Rule]]></PRINTNAME>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8AD3FC3535A9FCE040007F01002CB2-->  <ISGLOSSARY><![CDATA[N]]></ISGLOSSARY>
+<!--CB8AD3FC3535A9FCE040007F01002CB2--></AD_ELEMENT>
+
 <!--CC3A45F8D7F94D6799DA24A88F0184F5--><AD_ELEMENT>
 <!--CC3A45F8D7F94D6799DA24A88F0184F5-->  <AD_ELEMENT_ID><![CDATA[CC3A45F8D7F94D6799DA24A88F0184F5]]></AD_ELEMENT_ID>
 <!--CC3A45F8D7F94D6799DA24A88F0184F5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -208734,7 +208734,7 @@
 <!--8485B2388AB0444C9C525247EEAFCC84-->  <AD_TAB_ID><![CDATA[800110]]></AD_TAB_ID>
 <!--8485B2388AB0444C9C525247EEAFCC84-->  <AD_COLUMN_ID><![CDATA[69658C9581A74F548C387278CD7567A0]]></AD_COLUMN_ID>
 <!--8485B2388AB0444C9C525247EEAFCC84-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
-<!--8485B2388AB0444C9C525247EEAFCC84-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--8485B2388AB0444C9C525247EEAFCC84-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
 <!--8485B2388AB0444C9C525247EEAFCC84-->  <DISPLAYLOGIC><![CDATA[@Productiontype@='-']]></DISPLAYLOGIC>
 <!--8485B2388AB0444C9C525247EEAFCC84-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--8485B2388AB0444C9C525247EEAFCC84-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
@@ -232156,6 +232156,173 @@
 <!--CB0367690E27494FB100771E6834B364-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--CB0367690E27494FB100771E6834B364--></AD_FIELD>
 
+<!--CB2739BEE00DA0E9E040007F010023A5--><AD_FIELD>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <AD_FIELD_ID><![CDATA[CB2739BEE00DA0E9E040007F010023A5]]></AD_FIELD_ID>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <NAME><![CDATA[Organization Warehouse]]></NAME>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <HELP><![CDATA[Identifies a on hand warehouse of an Organization.]]></HELP>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <AD_TAB_ID><![CDATA[9F030341690C4BB3A3C15835AEC0FF39]]></AD_TAB_ID>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEDFFDA0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB2739BEE00DA0E9E040007F010023A5-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB2739BEE00DA0E9E040007F010023A5--></AD_FIELD>
+
+<!--CB2739BEE00EA0E9E040007F010023A5--><AD_FIELD>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <AD_FIELD_ID><![CDATA[CB2739BEE00EA0E9E040007F010023A5]]></AD_FIELD_ID>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <NAME><![CDATA[Client]]></NAME>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <AD_TAB_ID><![CDATA[9F030341690C4BB3A3C15835AEC0FF39]]></AD_TAB_ID>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEDFFEA0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB2739BEE00EA0E9E040007F010023A5-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB2739BEE00EA0E9E040007F010023A5--></AD_FIELD>
+
+<!--CB2739BEE00FA0E9E040007F010023A5--><AD_FIELD>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <AD_FIELD_ID><![CDATA[CB2739BEE00FA0E9E040007F010023A5]]></AD_FIELD_ID>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <NAME><![CDATA[Organization]]></NAME>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <AD_TAB_ID><![CDATA[9F030341690C4BB3A3C15835AEC0FF39]]></AD_TAB_ID>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEDFFFA0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB2739BEE00FA0E9E040007F010023A5-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB2739BEE00FA0E9E040007F010023A5--></AD_FIELD>
+
+<!--CB2739BEE010A0E9E040007F010023A5--><AD_FIELD>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <AD_FIELD_ID><![CDATA[CB2739BEE010A0E9E040007F010023A5]]></AD_FIELD_ID>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <NAME><![CDATA[Active]]></NAME>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[A flag indicating whether this record is available for use or de-activated.]]></DESCRIPTION>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <HELP><![CDATA[There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reporting. There are two reasons for de-activating and not deleting records: 
+(1) The system requires the record for auditing purposes.
+(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are existing invoices for it. By de-activating the Business Partner you prevent it from being used in future transactions.]]></HELP>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <AD_TAB_ID><![CDATA[9F030341690C4BB3A3C15835AEC0FF39]]></AD_TAB_ID>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE000A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB2739BEE010A0E9E040007F010023A5-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB2739BEE010A0E9E040007F010023A5--></AD_FIELD>
+
+<!--CB2739BEE011A0E9E040007F010023A5--><AD_FIELD>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <AD_FIELD_ID><![CDATA[CB2739BEE011A0E9E040007F010023A5]]></AD_FIELD_ID>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <NAME><![CDATA[Warehouse]]></NAME>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[The location where products arrive to or are sent from.]]></DESCRIPTION>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <HELP><![CDATA[The Warehouse identifies a unique Warehouse where products are stored or Services are provided.]]></HELP>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <AD_TAB_ID><![CDATA[9F030341690C4BB3A3C15835AEC0FF39]]></AD_TAB_ID>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE005A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB2739BEE011A0E9E040007F010023A5-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB2739BEE011A0E9E040007F010023A5--></AD_FIELD>
+
+<!--CB2739BEE012A0E9E040007F010023A5--><AD_FIELD>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <AD_FIELD_ID><![CDATA[CB2739BEE012A0E9E040007F010023A5]]></AD_FIELD_ID>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <NAME><![CDATA[Priority]]></NAME>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <DESCRIPTION><![CDATA[A defined level of importance or precedence.]]></DESCRIPTION>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <HELP><![CDATA[The Priority indicates the importance of this request.]]></HELP>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <AD_TAB_ID><![CDATA[9F030341690C4BB3A3C15835AEC0FF39]]></AD_TAB_ID>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <AD_COLUMN_ID><![CDATA[CB2739BEE006A0E9E040007F010023A5]]></AD_COLUMN_ID>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <DISPLAYLENGTH><![CDATA[12]]></DISPLAYLENGTH>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB2739BEE012A0E9E040007F010023A5-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB2739BEE012A0E9E040007F010023A5--></AD_FIELD>
+
 <!--CB4D64D81E944A07A338799F075FDABC--><AD_FIELD>
 <!--CB4D64D81E944A07A338799F075FDABC-->  <AD_FIELD_ID><![CDATA[CB4D64D81E944A07A338799F075FDABC]]></AD_FIELD_ID>
 <!--CB4D64D81E944A07A338799F075FDABC-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -232271,6 +232438,392 @@
 <!--CB64F390F3A3499895C6A8A807D80221-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--CB64F390F3A3499895C6A8A807D80221--></AD_FIELD>
 
+<!--CB8ABCB9585FBD11E040007F01002A9F--><AD_FIELD>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <AD_FIELD_ID><![CDATA[CB8ABCB9585FBD11E040007F01002A9F]]></AD_FIELD_ID>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <AD_TAB_ID><![CDATA[8A7BC392A4D548E1B97E11548E20E5F2]]></AD_TAB_ID>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64552F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB8ABCB9585FBD11E040007F01002A9F-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB8ABCB9585FBD11E040007F01002A9F--></AD_FIELD>
+
+<!--CB8ABCB95860BD11E040007F01002A9F--><AD_FIELD>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <AD_FIELD_ID><![CDATA[CB8ABCB95860BD11E040007F01002A9F]]></AD_FIELD_ID>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <NAME><![CDATA[Client]]></NAME>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <DESCRIPTION><![CDATA[Client for this installation.]]></DESCRIPTION>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <HELP><![CDATA[A Client is a company or a legal entity. You cannot share data between Clients.]]></HELP>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <AD_TAB_ID><![CDATA[8A7BC392A4D548E1B97E11548E20E5F2]]></AD_TAB_ID>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64652F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB8ABCB95860BD11E040007F01002A9F-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB8ABCB95860BD11E040007F01002A9F--></AD_FIELD>
+
+<!--CB8ABCB95861BD11E040007F01002A9F--><AD_FIELD>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <AD_FIELD_ID><![CDATA[CB8ABCB95861BD11E040007F01002A9F]]></AD_FIELD_ID>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <NAME><![CDATA[Organization]]></NAME>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <DESCRIPTION><![CDATA[Organizational entity within client]]></DESCRIPTION>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <HELP><![CDATA[An organization is a unit of your client or legal entity - examples are store, department. You can share data between organizations.]]></HELP>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <AD_TAB_ID><![CDATA[8A7BC392A4D548E1B97E11548E20E5F2]]></AD_TAB_ID>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64752F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB8ABCB95861BD11E040007F01002A9F-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB8ABCB95861BD11E040007F01002A9F--></AD_FIELD>
+
+<!--CB8ABCB95862BD11E040007F01002A9F--><AD_FIELD>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <AD_FIELD_ID><![CDATA[CB8ABCB95862BD11E040007F01002A9F]]></AD_FIELD_ID>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <NAME><![CDATA[Active]]></NAME>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <DESCRIPTION><![CDATA[A flag indicating whether this record is available for use or de-activated.]]></DESCRIPTION>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <HELP><![CDATA[There are two methods of making records unavailable in the system: One is to delete the record, the other is to de-activate the record. A de-activated record is not available for selection, but available for reporting. There are two reasons for de-activating and not deleting records: 
+(1) The system requires the record for auditing purposes.
+(2) The record is referenced by other records. E.g., you cannot delete a Business Partner, if there are existing invoices for it. By de-activating the Business Partner you prevent it from being used in future transactions.]]></HELP>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <AD_TAB_ID><![CDATA[8A7BC392A4D548E1B97E11548E20E5F2]]></AD_TAB_ID>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64852F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <SEQNO><![CDATA[40]]></SEQNO>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB8ABCB95862BD11E040007F01002A9F-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB8ABCB95862BD11E040007F01002A9F--></AD_FIELD>
+
+<!--CB8ABCB95863BD11E040007F01002A9F--><AD_FIELD>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <AD_FIELD_ID><![CDATA[CB8ABCB95863BD11E040007F01002A9F]]></AD_FIELD_ID>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <NAME><![CDATA[Name]]></NAME>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <DESCRIPTION><![CDATA[A non-unique identifier for a record/document often used as a search tool.]]></DESCRIPTION>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <HELP><![CDATA[A more descriptive identifier (that does need to be unique) of a record/document that is used as a default search option along with the search key (that is unique and mostly shorter). It is up to 60 characters in length.]]></HELP>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <AD_TAB_ID><![CDATA[8A7BC392A4D548E1B97E11548E20E5F2]]></AD_TAB_ID>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <AD_COLUMN_ID><![CDATA[CB8AA603D64D52F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <DISPLAYLENGTH><![CDATA[60]]></DISPLAYLENGTH>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB8ABCB95863BD11E040007F01002A9F-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB8ABCB95863BD11E040007F01002A9F--></AD_FIELD>
+
+<!--CB8ABCB95865BD11E040007F01002A9F--><AD_FIELD>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <AD_FIELD_ID><![CDATA[CB8ABCB95865BD11E040007F01002A9F]]></AD_FIELD_ID>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <NAME><![CDATA[Procedure]]></NAME>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <DESCRIPTION><![CDATA[Name of the Database Procedure]]></DESCRIPTION>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <HELP><![CDATA[The Procedure indicates the name of the database procedure called by this report or process.]]></HELP>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <AD_TAB_ID><![CDATA[8A7BC392A4D548E1B97E11548E20E5F2]]></AD_TAB_ID>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <AD_COLUMN_ID><![CDATA[CB8AA603D65152F6E040007F01002AD2]]></AD_COLUMN_ID>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <DISPLAYLENGTH><![CDATA[60]]></DISPLAYLENGTH>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <SEQNO><![CDATA[20]]></SEQNO>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB8ABCB95865BD11E040007F01002A9F-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB8ABCB95865BD11E040007F01002A9F--></AD_FIELD>
+
+<!--CB9E2FD2CC0BDE61E040007F010001E1--><AD_FIELD>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <AD_FIELD_ID><![CDATA[CB9E2FD2CC0BDE61E040007F010001E1]]></AD_FIELD_ID>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <AD_TAB_ID><![CDATA[800113]]></AD_TAB_ID>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <AD_COLUMN_ID><![CDATA[CB9E2FD2CC03DE61E040007F010001E1]]></AD_COLUMN_ID>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <DISPLAYLOGIC><![CDATA[@Productiontype@='-']]></DISPLAYLOGIC>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <SEQNO><![CDATA[90]]></SEQNO>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <GRID_SEQNO><![CDATA[0]]></GRID_SEQNO>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB9E2FD2CC0BDE61E040007F010001E1-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB9E2FD2CC0BDE61E040007F010001E1--></AD_FIELD>
+
+<!--CB9E2FD2CC1FDE61E040007F010001E1--><AD_FIELD>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <AD_FIELD_ID><![CDATA[CB9E2FD2CC1FDE61E040007F010001E1]]></AD_FIELD_ID>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <AD_TAB_ID><![CDATA[187]]></AD_TAB_ID>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <AD_COLUMN_ID><![CDATA[CB9E308EE8DFDCBAE040007F010001E7]]></AD_COLUMN_ID>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <SEQNO><![CDATA[105]]></SEQNO>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <GRID_SEQNO><![CDATA[0]]></GRID_SEQNO>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB9E2FD2CC1FDE61E040007F010001E1-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB9E2FD2CC1FDE61E040007F010001E1--></AD_FIELD>
+
+<!--CB9E2FD2CC3FDE61E040007F010001E1--><AD_FIELD>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <AD_FIELD_ID><![CDATA[CB9E2FD2CC3FDE61E040007F010001E1]]></AD_FIELD_ID>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <NAME><![CDATA[Description]]></NAME>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <DESCRIPTION><![CDATA[A space to write additional related information.]]></DESCRIPTION>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <HELP><![CDATA[A description is limited to 255 characters.]]></HELP>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <AD_TAB_ID><![CDATA[8A7BC392A4D548E1B97E11548E20E5F2]]></AD_TAB_ID>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <AD_COLUMN_ID><![CDATA[CB9E2FD2CC3EDE61E040007F010001E1]]></AD_COLUMN_ID>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <DISPLAYLENGTH><![CDATA[2000]]></DISPLAYLENGTH>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <SEQNO><![CDATA[30]]></SEQNO>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB9E2FD2CC3FDE61E040007F010001E1-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB9E2FD2CC3FDE61E040007F010001E1--></AD_FIELD>
+
+<!--CB9E32CCC775256DE040007F010001D6--><AD_FIELD>
+<!--CB9E32CCC775256DE040007F010001D6-->  <AD_FIELD_ID><![CDATA[CB9E32CCC775256DE040007F010001D6]]></AD_FIELD_ID>
+<!--CB9E32CCC775256DE040007F010001D6-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9E32CCC775256DE040007F010001D6-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9E32CCC775256DE040007F010001D6-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9E32CCC775256DE040007F010001D6-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB9E32CCC775256DE040007F010001D6-->  <AD_TAB_ID><![CDATA[177]]></AD_TAB_ID>
+<!--CB9E32CCC775256DE040007F010001D6-->  <AD_COLUMN_ID><![CDATA[CB9E308EE8BFDCBAE040007F010001E7]]></AD_COLUMN_ID>
+<!--CB9E32CCC775256DE040007F010001D6-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB9E32CCC775256DE040007F010001D6-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB9E32CCC775256DE040007F010001D6-->  <SEQNO><![CDATA[65]]></SEQNO>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9E32CCC775256DE040007F010001D6-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB9E32CCC775256DE040007F010001D6-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9E32CCC775256DE040007F010001D6-->  <GRID_SEQNO><![CDATA[0]]></GRID_SEQNO>
+<!--CB9E32CCC775256DE040007F010001D6-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB9E32CCC775256DE040007F010001D6-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB9E32CCC775256DE040007F010001D6-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB9E32CCC775256DE040007F010001D6-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB9E32CCC775256DE040007F010001D6--></AD_FIELD>
+
+<!--CB9F7E1068439731E040007F01000F07--><AD_FIELD>
+<!--CB9F7E1068439731E040007F01000F07-->  <AD_FIELD_ID><![CDATA[CB9F7E1068439731E040007F01000F07]]></AD_FIELD_ID>
+<!--CB9F7E1068439731E040007F01000F07-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9F7E1068439731E040007F01000F07-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9F7E1068439731E040007F01000F07-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9F7E1068439731E040007F01000F07-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB9F7E1068439731E040007F01000F07-->  <AD_TAB_ID><![CDATA[800110]]></AD_TAB_ID>
+<!--CB9F7E1068439731E040007F01000F07-->  <AD_COLUMN_ID><![CDATA[CB9E32CCC77F256DE040007F010001D6]]></AD_COLUMN_ID>
+<!--CB9F7E1068439731E040007F01000F07-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--CB9F7E1068439731E040007F01000F07-->  <DISPLAYLOGIC><![CDATA[@Productiontype@='-']]></DISPLAYLOGIC>
+<!--CB9F7E1068439731E040007F01000F07-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB9F7E1068439731E040007F01000F07-->  <SEQNO><![CDATA[140]]></SEQNO>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9F7E1068439731E040007F01000F07-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB9F7E1068439731E040007F01000F07-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9F7E1068439731E040007F01000F07-->  <GRID_SEQNO><![CDATA[0]]></GRID_SEQNO>
+<!--CB9F7E1068439731E040007F01000F07-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB9F7E1068439731E040007F01000F07-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB9F7E1068439731E040007F01000F07-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB9F7E1068439731E040007F01000F07-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB9F7E1068439731E040007F01000F07--></AD_FIELD>
+
+<!--CB9F7E1068589731E040007F01000F07--><AD_FIELD>
+<!--CB9F7E1068589731E040007F01000F07-->  <AD_FIELD_ID><![CDATA[CB9F7E1068589731E040007F01000F07]]></AD_FIELD_ID>
+<!--CB9F7E1068589731E040007F01000F07-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9F7E1068589731E040007F01000F07-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9F7E1068589731E040007F01000F07-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9F7E1068589731E040007F01000F07-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB9F7E1068589731E040007F01000F07-->  <AD_TAB_ID><![CDATA[387B6179438D4C4CB40769A77F4C304C]]></AD_TAB_ID>
+<!--CB9F7E1068589731E040007F01000F07-->  <AD_COLUMN_ID><![CDATA[CB9E308EE8DFDCBAE040007F010001E7]]></AD_COLUMN_ID>
+<!--CB9F7E1068589731E040007F01000F07-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB9F7E1068589731E040007F01000F07-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9F7E1068589731E040007F01000F07-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB9F7E1068589731E040007F01000F07-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9F7E1068589731E040007F01000F07-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB9F7E1068589731E040007F01000F07-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB9F7E1068589731E040007F01000F07-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB9F7E1068589731E040007F01000F07-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB9F7E1068589731E040007F01000F07--></AD_FIELD>
+
+<!--CB9F7E1068599731E040007F01000F07--><AD_FIELD>
+<!--CB9F7E1068599731E040007F01000F07-->  <AD_FIELD_ID><![CDATA[CB9F7E1068599731E040007F01000F07]]></AD_FIELD_ID>
+<!--CB9F7E1068599731E040007F01000F07-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9F7E1068599731E040007F01000F07-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9F7E1068599731E040007F01000F07-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9F7E1068599731E040007F01000F07-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB9F7E1068599731E040007F01000F07-->  <AD_TAB_ID><![CDATA[AF4090093D471431E040007F010048A5]]></AD_TAB_ID>
+<!--CB9F7E1068599731E040007F01000F07-->  <AD_COLUMN_ID><![CDATA[CB9E308EE8DFDCBAE040007F010001E7]]></AD_COLUMN_ID>
+<!--CB9F7E1068599731E040007F01000F07-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB9F7E1068599731E040007F01000F07-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9F7E1068599731E040007F01000F07-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB9F7E1068599731E040007F01000F07-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9F7E1068599731E040007F01000F07-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB9F7E1068599731E040007F01000F07-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB9F7E1068599731E040007F01000F07-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB9F7E1068599731E040007F01000F07-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB9F7E1068599731E040007F01000F07--></AD_FIELD>
+
+<!--CB9F7E1068619731E040007F01000F07--><AD_FIELD>
+<!--CB9F7E1068619731E040007F01000F07-->  <AD_FIELD_ID><![CDATA[CB9F7E1068619731E040007F01000F07]]></AD_FIELD_ID>
+<!--CB9F7E1068619731E040007F01000F07-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB9F7E1068619731E040007F01000F07-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB9F7E1068619731E040007F01000F07-->  <NAME><![CDATA[Warehouse Rule]]></NAME>
+<!--CB9F7E1068619731E040007F01000F07-->  <HELP><![CDATA[Definition of a Warehouse Rule to be applied when getting stock from the warehouse.]]></HELP>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--CB9F7E1068619731E040007F01000F07-->  <AD_TAB_ID><![CDATA[293]]></AD_TAB_ID>
+<!--CB9F7E1068619731E040007F01000F07-->  <AD_COLUMN_ID><![CDATA[CB9E308EE8DFDCBAE040007F010001E7]]></AD_COLUMN_ID>
+<!--CB9F7E1068619731E040007F01000F07-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISDISPLAYED><![CDATA[N]]></ISDISPLAYED>
+<!--CB9F7E1068619731E040007F01000F07-->  <DISPLAYLENGTH><![CDATA[32]]></DISPLAYLENGTH>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--CB9F7E1068619731E040007F01000F07-->  <SHOWINRELATION><![CDATA[N]]></SHOWINRELATION>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--CB9F7E1068619731E040007F01000F07-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--CB9F7E1068619731E040007F01000F07-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--CB9F7E1068619731E040007F01000F07-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--CB9F7E1068619731E040007F01000F07-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--CB9F7E1068619731E040007F01000F07-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--CB9F7E1068619731E040007F01000F07--></AD_FIELD>
+
 <!--CCC42B29FEAA4FC5BCABCE0F4E939401--><AD_FIELD>
 <!--CCC42B29FEAA4FC5BCABCE0F4E939401-->  <AD_FIELD_ID><![CDATA[CCC42B29FEAA4FC5BCABCE0F4E939401]]></AD_FIELD_ID>
 <!--CCC42B29FEAA4FC5BCABCE0F4E939401-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MENU.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_MENU.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -4553,6 +4553,18 @@
 <!--B902D95D3F654C7096C428F50381E38A-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--B902D95D3F654C7096C428F50381E38A--></AD_MENU>
 
+<!--BC399BACA2F34B968C54555D79ED66A7--><AD_MENU>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <AD_MENU_ID><![CDATA[BC399BACA2F34B968C54555D79ED66A7]]></AD_MENU_ID>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <NAME><![CDATA[Warehouse Rules]]></NAME>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <ISSUMMARY><![CDATA[N]]></ISSUMMARY>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <ACTION><![CDATA[W]]></ACTION>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <AD_WINDOW_ID><![CDATA[FC404D2406A9491CBD905D0D38F04846]]></AD_WINDOW_ID>
+<!--BC399BACA2F34B968C54555D79ED66A7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--BC399BACA2F34B968C54555D79ED66A7--></AD_MENU>
+
 <!--BE86736DF4AB4568A316A3922E6D6B7B--><AD_MENU>
 <!--BE86736DF4AB4568A316A3922E6D6B7B-->  <AD_MENU_ID><![CDATA[BE86736DF4AB4568A316A3922E6D6B7B]]></AD_MENU_ID>
 <!--BE86736DF4AB4568A316A3922E6D6B7B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_MESSAGE.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_MESSAGE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -14585,6 +14585,17 @@
 <!--04EEC6B52A7B4C2CACA1F767217FAFB7-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
 <!--04EEC6B52A7B4C2CACA1F767217FAFB7--></AD_MESSAGE>
 
+<!--055CE8C3899346499AB8E10E7A7108DA--><AD_MESSAGE>
+<!--055CE8C3899346499AB8E10E7A7108DA-->  <AD_MESSAGE_ID><![CDATA[055CE8C3899346499AB8E10E7A7108DA]]></AD_MESSAGE_ID>
+<!--055CE8C3899346499AB8E10E7A7108DA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--055CE8C3899346499AB8E10E7A7108DA-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--055CE8C3899346499AB8E10E7A7108DA-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--055CE8C3899346499AB8E10E7A7108DA-->  <VALUE><![CDATA[NotEnoughLocatorUniqueStock]]></VALUE>
+<!--055CE8C3899346499AB8E10E7A7108DA-->  <MSGTEXT><![CDATA[Not enough stock from unique Storage Bin]]></MSGTEXT>
+<!--055CE8C3899346499AB8E10E7A7108DA-->  <MSGTYPE><![CDATA[E]]></MSGTYPE>
+<!--055CE8C3899346499AB8E10E7A7108DA-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--055CE8C3899346499AB8E10E7A7108DA--></AD_MESSAGE>
+
 <!--05B3B100FC1449908A9F42901B72185F--><AD_MESSAGE>
 <!--05B3B100FC1449908A9F42901B72185F-->  <AD_MESSAGE_ID><![CDATA[05B3B100FC1449908A9F42901B72185F]]></AD_MESSAGE_ID>
 <!--05B3B100FC1449908A9F42901B72185F-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_TAB.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_TAB.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -13437,6 +13437,32 @@
 <!--8652BB9E40664869A5132CEB8A907B9B-->  <EM_OBUIAPP_SHOW_SELECT><![CDATA[Y]]></EM_OBUIAPP_SHOW_SELECT>
 <!--8652BB9E40664869A5132CEB8A907B9B--></AD_TAB>
 
+<!--8A7BC392A4D548E1B97E11548E20E5F2--><AD_TAB>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <AD_TAB_ID><![CDATA[8A7BC392A4D548E1B97E11548E20E5F2]]></AD_TAB_ID>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <NAME><![CDATA[Rule]]></NAME>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <AD_WINDOW_ID><![CDATA[FC404D2406A9491CBD905D0D38F04846]]></AD_WINDOW_ID>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <SEQNO><![CDATA[10]]></SEQNO>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <TABLEVEL><![CDATA[0]]></TABLEVEL>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <ISSINGLEROW><![CDATA[N]]></ISSINGLEROW>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <ISINFOTAB><![CDATA[N]]></ISINFOTAB>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <ISTRANSLATIONTAB><![CDATA[N]]></ISTRANSLATIONTAB>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <HASTREE><![CDATA[N]]></HASTREE>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <PROCESSING><![CDATA[N]]></PROCESSING>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <IMPORTFIELDS><![CDATA[N]]></IMPORTFIELDS>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <ISSORTTAB><![CDATA[N]]></ISSORTTAB>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <UIPATTERN><![CDATA[STD]]></UIPATTERN>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <EM_OBUIAPP_CAN_ADD><![CDATA[N]]></EM_OBUIAPP_CAN_ADD>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <EM_OBUIAPP_CAN_DELETE><![CDATA[N]]></EM_OBUIAPP_CAN_DELETE>
+<!--8A7BC392A4D548E1B97E11548E20E5F2-->  <EM_OBUIAPP_SHOW_SELECT><![CDATA[Y]]></EM_OBUIAPP_SHOW_SELECT>
+<!--8A7BC392A4D548E1B97E11548E20E5F2--></AD_TAB>
+
 <!--8E5972CF3664486D9D887BDEDA88627D--><AD_TAB>
 <!--8E5972CF3664486D9D887BDEDA88627D-->  <AD_TAB_ID><![CDATA[8E5972CF3664486D9D887BDEDA88627D]]></AD_TAB_ID>
 <!--8E5972CF3664486D9D887BDEDA88627D-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -13555,6 +13581,33 @@
 <!--9E7E3EF08A054A30BB084DC5D2830926-->  <EM_OBUIAPP_SHOW_SELECT><![CDATA[Y]]></EM_OBUIAPP_SHOW_SELECT>
 <!--9E7E3EF08A054A30BB084DC5D2830926--></AD_TAB>
 
+<!--9F030341690C4BB3A3C15835AEC0FF39--><AD_TAB>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <AD_TAB_ID><![CDATA[9F030341690C4BB3A3C15835AEC0FF39]]></AD_TAB_ID>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <NAME><![CDATA[Warehouse]]></NAME>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <HELP><![CDATA[Relation of prioritized on hand warehouses of the Organization.]]></HELP>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <AD_WINDOW_ID><![CDATA[110]]></AD_WINDOW_ID>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <SEQNO><![CDATA[70]]></SEQNO>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <TABLEVEL><![CDATA[1]]></TABLEVEL>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <ISSINGLEROW><![CDATA[N]]></ISSINGLEROW>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <ISINFOTAB><![CDATA[N]]></ISINFOTAB>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <ISTRANSLATIONTAB><![CDATA[N]]></ISTRANSLATIONTAB>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <HASTREE><![CDATA[N]]></HASTREE>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <PROCESSING><![CDATA[N]]></PROCESSING>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <IMPORTFIELDS><![CDATA[N]]></IMPORTFIELDS>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <ISSORTTAB><![CDATA[N]]></ISSORTTAB>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <UIPATTERN><![CDATA[STD]]></UIPATTERN>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <SHOWPARENTBUTTONS><![CDATA[Y]]></SHOWPARENTBUTTONS>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <EM_OBUIAPP_CAN_ADD><![CDATA[N]]></EM_OBUIAPP_CAN_ADD>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <EM_OBUIAPP_CAN_DELETE><![CDATA[N]]></EM_OBUIAPP_CAN_DELETE>
+<!--9F030341690C4BB3A3C15835AEC0FF39-->  <EM_OBUIAPP_SHOW_SELECT><![CDATA[Y]]></EM_OBUIAPP_SHOW_SELECT>
+<!--9F030341690C4BB3A3C15835AEC0FF39--></AD_TAB>
+
 <!--A0F74205D11848FAB0393A11B0CFB515--><AD_TAB>
 <!--A0F74205D11848FAB0393A11B0CFB515-->  <AD_TAB_ID><![CDATA[A0F74205D11848FAB0393A11B0CFB515]]></AD_TAB_ID>
 <!--A0F74205D11848FAB0393A11B0CFB515-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_TABLE.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_TABLE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -8324,6 +8324,28 @@
 <!--21E98AE4A7D94935A32D17B6EFC81AAC-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1D54B84E040007F01006125]]></AD_PACKAGE_ID>
 <!--21E98AE4A7D94935A32D17B6EFC81AAC--></AD_TABLE>
 
+<!--26673F55911848E894D837F57207A92B--><AD_TABLE>
+<!--26673F55911848E894D837F57207A92B-->  <AD_TABLE_ID><![CDATA[26673F55911848E894D837F57207A92B]]></AD_TABLE_ID>
+<!--26673F55911848E894D837F57207A92B-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--26673F55911848E894D837F57207A92B-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--26673F55911848E894D837F57207A92B-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--26673F55911848E894D837F57207A92B-->  <NAME><![CDATA[OrganizationWarehouse]]></NAME>
+<!--26673F55911848E894D837F57207A92B-->  <HELP><![CDATA[Defines the on-hand warehouses of an Organization and its usage priority.]]></HELP>
+<!--26673F55911848E894D837F57207A92B-->  <TABLENAME><![CDATA[AD_Org_Warehouse]]></TABLENAME>
+<!--26673F55911848E894D837F57207A92B-->  <CLASSNAME><![CDATA[OrgWarehouse]]></CLASSNAME>
+<!--26673F55911848E894D837F57207A92B-->  <ISVIEW><![CDATA[N]]></ISVIEW>
+<!--26673F55911848E894D837F57207A92B-->  <ACCESSLEVEL><![CDATA[3]]></ACCESSLEVEL>
+<!--26673F55911848E894D837F57207A92B-->  <AD_WINDOW_ID><![CDATA[110]]></AD_WINDOW_ID>
+<!--26673F55911848E894D837F57207A92B-->  <ISSECURITYENABLED><![CDATA[N]]></ISSECURITYENABLED>
+<!--26673F55911848E894D837F57207A92B-->  <ISDELETEABLE><![CDATA[Y]]></ISDELETEABLE>
+<!--26673F55911848E894D837F57207A92B-->  <ISHIGHVOLUME><![CDATA[N]]></ISHIGHVOLUME>
+<!--26673F55911848E894D837F57207A92B-->  <IMPORTTABLE><![CDATA[N]]></IMPORTTABLE>
+<!--26673F55911848E894D837F57207A92B-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
+<!--26673F55911848E894D837F57207A92B-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
+<!--26673F55911848E894D837F57207A92B-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--26673F55911848E894D837F57207A92B-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1D54B84E040007F01006125]]></AD_PACKAGE_ID>
+<!--26673F55911848E894D837F57207A92B--></AD_TABLE>
+
 <!--26857B460E444AC2A398FA7107A2AD06--><AD_TABLE>
 <!--26857B460E444AC2A398FA7107A2AD06-->  <AD_TABLE_ID><![CDATA[26857B460E444AC2A398FA7107A2AD06]]></AD_TABLE_ID>
 <!--26857B460E444AC2A398FA7107A2AD06-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -9257,6 +9279,28 @@
 <!--88386FBE7A274F0EA414C989697B8680-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1EF4B84E040007F01006125]]></AD_PACKAGE_ID>
 <!--88386FBE7A274F0EA414C989697B8680--></AD_TABLE>
 
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1--><AD_TABLE>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <AD_TABLE_ID><![CDATA[8D057FD1218B44C3BD5B97DA65A6E3C1]]></AD_TABLE_ID>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <NAME><![CDATA[WarehouseRule]]></NAME>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <HELP><![CDATA[Definition of the Warehouse Rules available for the client.]]></HELP>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <TABLENAME><![CDATA[M_Warehouse_Rule]]></TABLENAME>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <CLASSNAME><![CDATA[WarehouseRule]]></CLASSNAME>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <ISVIEW><![CDATA[N]]></ISVIEW>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <ACCESSLEVEL><![CDATA[6]]></ACCESSLEVEL>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <AD_WINDOW_ID><![CDATA[FC404D2406A9491CBD905D0D38F04846]]></AD_WINDOW_ID>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <ISSECURITYENABLED><![CDATA[N]]></ISSECURITYENABLED>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <ISDELETEABLE><![CDATA[Y]]></ISDELETEABLE>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <ISHIGHVOLUME><![CDATA[N]]></ISHIGHVOLUME>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <IMPORTTABLE><![CDATA[N]]></IMPORTTABLE>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <ISCHANGELOG><![CDATA[N]]></ISCHANGELOG>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <ISDEFAULTACCT><![CDATA[N]]></ISDEFAULTACCT>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1-->  <AD_PACKAGE_ID><![CDATA[5A3ED54AB1D54B84E040007F01006125]]></AD_PACKAGE_ID>
+<!--8D057FD1218B44C3BD5B97DA65A6E3C1--></AD_TABLE>
+
 <!--8EABE4230116400FA30CAF1A57BBC579--><AD_TABLE>
 <!--8EABE4230116400FA30CAF1A57BBC579-->  <AD_TABLE_ID><![CDATA[8EABE4230116400FA30CAF1A57BBC579]]></AD_TABLE_ID>
 <!--8EABE4230116400FA30CAF1A57BBC579-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_TREENODE.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_TREENODE.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -4079,6 +4079,17 @@
 <!--BF4B7C5FF61945AAA6357DE56CA92157-->  <SEQNO><![CDATA[10]]></SEQNO>
 <!--BF4B7C5FF61945AAA6357DE56CA92157--></AD_TREENODE>
 
+<!--CB8D7C97A32FBEAEE040007F01000D19--><AD_TREENODE>
+<!--CB8D7C97A32FBEAEE040007F01000D19-->  <AD_TREENODE_ID><![CDATA[CB8D7C97A32FBEAEE040007F01000D19]]></AD_TREENODE_ID>
+<!--CB8D7C97A32FBEAEE040007F01000D19-->  <AD_TREE_ID><![CDATA[10]]></AD_TREE_ID>
+<!--CB8D7C97A32FBEAEE040007F01000D19-->  <NODE_ID><![CDATA[BC399BACA2F34B968C54555D79ED66A7]]></NODE_ID>
+<!--CB8D7C97A32FBEAEE040007F01000D19-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--CB8D7C97A32FBEAEE040007F01000D19-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--CB8D7C97A32FBEAEE040007F01000D19-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--CB8D7C97A32FBEAEE040007F01000D19-->  <PARENT_ID><![CDATA[800256]]></PARENT_ID>
+<!--CB8D7C97A32FBEAEE040007F01000D19-->  <SEQNO><![CDATA[80]]></SEQNO>
+<!--CB8D7C97A32FBEAEE040007F01000D19--></AD_TREENODE>
+
 <!--D0E4A95994554D6590625F6D302336D8--><AD_TREENODE>
 <!--D0E4A95994554D6590625F6D302336D8-->  <AD_TREENODE_ID><![CDATA[D0E4A95994554D6590625F6D302336D8]]></AD_TREENODE_ID>
 <!--D0E4A95994554D6590625F6D302336D8-->  <AD_TREE_ID><![CDATA[10]]></AD_TREE_ID>
--- a/src-db/database/sourcedata/AD_WINDOW.xml	Mon Nov 05 13:20:31 2012 +0000
+++ b/src-db/database/sourcedata/AD_WINDOW.xml	Mon Nov 05 17:44:56 2012 +0100
@@ -3085,6 +3085,22 @@
 <!--EF3E837705944F4DBF398D683D36ACE0-->  <ISADVANCEDFEATURE><![CDATA[N]]></ISADVANCEDFEATURE>
 <!--EF3E837705944F4DBF398D683D36ACE0--></AD_WINDOW>
 
+<!--FC404D2406A9491CBD905D0D38F04846--><AD_WINDOW>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <AD_WINDOW_ID><![CDATA[FC404D2406A9491CBD905D0D38F04846]]></AD_WINDOW_ID>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <NAME><![CDATA[Warehouse Rules]]></NAME>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <HELP><![CDATA[Warehouse Rules definition]]></HELP>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <WINDOWTYPE><![CDATA[M]]></WINDOWTYPE>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <ISSOTRX><![CDATA[Y]]></ISSOTRX>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <PROCESSING><![CDATA[N]]></PROCESSING>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <ISDEFAULT><![CDATA[N]]></ISDEFAULT>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <ISTHREADSAFE><![CDATA[N]]></ISTHREADSAFE>
+<!--FC404D2406A9491CBD905D0D38F04846-->  <ISADVANCEDFEATURE><![CDATA[N]]></ISADVANCEDFEATURE>
+<!--FC404D2406A9491CBD905D0D38F04846--></AD_WINDOW>
+
 <!--FEB8679CAA0D47E5978F10E22566FCEA--><AD_WINDOW>
 <!--FEB8679CAA0D47E5978F10E22566FCEA-->  <AD_WINDOW_ID><![CDATA[FEB8679CAA0D47E5978F10E22566FCEA]]></AD_WINDOW_ID>
 <!--FEB8679CAA0D47E5978F10E22566FCEA-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/AlertMASequenceProduct.class has changed
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/AlertMASequenceProductData.class has changed
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/InitializeOnHandWarehouse.class has changed
Binary file src-util/modulescript/build/classes/org/openbravo/modulescript/InitializeOnHandWarehouseData.class has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/AlertMASequenceProduct.java	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,74 @@
+/*
+ *************************************************************************
+ * 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) 2012 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.modulescript;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.database.ConnectionProvider;
+
+public class AlertMASequenceProduct extends ModuleScript {
+
+  final static private String ALERT_RULE_SQL = "select ma_sequenceproduct_id as referencekey_id, ad_column_identifier('MA_SequenceProduct', ma_sequenceproduct_id, 'en_US') as record_id , 0 as ad_role_id, null as ad_user_id, 'Deprecated Unique Attribute in use. Set the Warehouse rule' as description, 'Y' as isactive, ad_org_id, ad_client_id, now() as created, 0 as createdBy, now() as updated, 0 as updatedBy  from ma_sequenceproduct where uniqueattconsum = 'Y' and m_warehouse_rule_id IS NULL";
+  final static private String PSECUENCE_WINDOW = "800051";
+  final static private String PSECUENCE_TAB = "800110";
+  final static private String ALERT_RULE="Deprecated Unique Attribute in use. Set the Warehouse rule";
+  @Override
+  public void execute() {
+    try {
+      ConnectionProvider cp = getConnectionProvider();
+      if (!AlertMASequenceProductData.existsAlertRule(cp, ALERT_RULE,null)) {
+        AlertMASequenceProductData[] data = AlertMASequenceProductData.select(cp);
+        for (AlertMASequenceProductData seqproduct : data) {
+          createAlert(cp, seqproduct);
+        } 
+      }
+      
+    } catch (Exception e) {
+      handleError(e);
+    }
+  }
+
+  private void createAlert(ConnectionProvider cp, AlertMASequenceProductData seqproduct)
+      throws ServletException {
+
+   
+    String oldAlertRuleId = AlertMASequenceProductData.getAlertRuleId(cp, ALERT_RULE,
+        seqproduct.adClientId);
+    if (!AlertMASequenceProductData.existsAlert(cp, oldAlertRuleId, seqproduct.maSequenceproductId)) {
+      if (!AlertMASequenceProductData.existsAlertRule(cp, ALERT_RULE, seqproduct.adClientId)) {
+        AlertMASequenceProductData.insertAlertRule(cp, seqproduct.adClientId, ALERT_RULE,
+            PSECUENCE_TAB, ALERT_RULE_SQL);
+        AlertMASequenceProductData[] roles = AlertMASequenceProductData.getRoleId(cp,
+            PSECUENCE_WINDOW, seqproduct.adClientId);
+        for (AlertMASequenceProductData role : roles) {
+          AlertMASequenceProductData.insertAlertRecipient(cp, seqproduct.adClientId,
+              seqproduct.adOrgId,
+              AlertMASequenceProductData.getAlertRuleId(cp, ALERT_RULE, seqproduct.adClientId),
+              role.adRoleId);
+        }
+      }
+      String alertRuleId = AlertMASequenceProductData.getAlertRuleId(cp, ALERT_RULE,
+          seqproduct.adClientId);
+      AlertMASequenceProductData.insertAlert(cp, seqproduct.adClientId, seqproduct.adOrgId,
+          ALERT_RULE, alertRuleId, seqproduct.product, seqproduct.maSequenceproductId);
+    }
+  }
+
+  
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/AlertMASequenceProduct_data.xsql	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,161 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * 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) 2012 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+<SqlClass name="AlertMASequenceProductData" package="org.openbravo.modulescript">
+   <SqlClassComment></SqlClassComment>
+   <SqlMethod name="select" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+      select ma_sequenceproduct_id, ad_client_id, ad_org_id, 0 as ad_role_id, 
+      ad_column_identifier('MA_SequenceProduct', ma_sequenceproduct_id, 'en_US') as product, '' as record_id
+      from ma_sequenceproduct 
+      where uniqueattconsum = 'Y' and m_warehouse_rule_id IS NULL  
+      ]]>
+    </Sql>
+  </SqlMethod>
+  
+  <SqlMethod name="existsAlertRule" type="preparedStatement" return="boolean">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+       SELECT COUNT(*) AS EXISTING
+       FROM AD_ALERTRULE
+       WHERE NAME = ?
+         AND ISACTIVE = 'Y'
+         AND 1=1      
+      ]]>
+    </Sql>
+    <Parameter name="alertRule"/>
+    <Parameter name="client" optional="true" after="AND 1=1"><![CDATA[ AND AD_CLIENT_ID = ?]]></Parameter>
+  </SqlMethod>
+  
+  <SqlMethod name="existsAlert" type="preparedStatement" return="boolean">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+       SELECT COUNT(*) AS EXISTING
+       FROM AD_ALERT
+       WHERE AD_ALERTRULE_ID = ?
+       AND REFERENCEKEY_ID = ?
+       AND ISFIXED = 'N'
+      ]]>
+    </Sql>
+    <Parameter name="alertRule"/>
+    <Parameter name="invoice"/>
+  </SqlMethod>
+  <SqlMethod name="getAlertRuleId" type="preparedStatement" return="string">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+       SELECT MAX(ad_alertrule_id) AS name
+       FROM AD_ALERTRULE
+       WHERE NAME LIKE ?
+         AND ISACTIVE = 'Y'
+         AND AD_CLIENT_ID = ?
+      ]]></Sql>
+    <Parameter name="name"/>
+    <Parameter name="client"/>
+  </SqlMethod>
+  <SqlMethod name="getRoleId" type="preparedStatement" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+       SELECT distinct ad_role_id
+       FROM ad_window_access
+       WHERE ad_window_id = ?
+       AND AD_CLIENT_ID = ?
+         AND ISACTIVE = 'Y'
+      ]]></Sql>
+    <Parameter name="window"/>
+    <Parameter name="clientId"/>
+  </SqlMethod>
+  <SqlMethod name="insertAlertRule" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+      INSERT INTO AD_ALERTRULE (
+        AD_ALERTRULE_ID, AD_CLIENT_ID, AD_ORG_ID,ISACTIVE,
+        CREATED, CREATEDBY,  UPDATED, UPDATEDBY,
+        NAME, AD_TAB_ID, FILTERCLAUSE, TYPE,
+        SQL
+      ) VALUES (
+        get_uuid(), ?, '0', 'Y',
+        now(), '100', now(), '100',
+        ?, ?, '', 'D',
+        ?
+      )
+    ]]></Sql>
+    <Parameter name="clientId"/>
+    <Parameter name="name"/>
+    <Parameter name="tabId"/>
+    <Parameter name="sql"/>
+  </SqlMethod>
+  <SqlMethod name="insertAlert" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+      INSERT INTO AD_Alert (
+        AD_Alert_ID, AD_Client_ID, AD_Org_ID, IsActive,
+        Created, CreatedBy, Updated, UpdatedBy,
+        Description, AD_AlertRule_ID, Record_Id, Referencekey_ID
+      ) VALUES (
+        get_uuid(), ?, ?, 'Y',
+        NOW(), '0', NOW(), '0',
+        ?, ?, ?, ?)
+      ]]>
+    </Sql>
+    <Parameter name="client"/>
+    <Parameter name="org"/>
+    <Parameter name="description" />
+    <Parameter name="adAlertRuleId" />
+    <Parameter name="recordId" />
+    <Parameter name="referencekey_id" />
+  </SqlMethod>
+  <SqlMethod name="insertAlertRecipient" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+    INSERT INTO ad_alertrecipient(
+            ad_user_id, ad_client_id, ad_org_id, isactive, created, createdby, 
+            updated, updatedby, ad_alertrecipient_id, ad_alertrule_id, ad_role_id, 
+            sendemail)
+    VALUES (null, ?, ?, 'Y', now(), '100', 
+            now(), '100', get_uuid(), ?, ?, 
+            'N')
+      ]]>
+    </Sql>
+    <Parameter name="client"/>
+    <Parameter name="org"/>
+    <Parameter name="adAlertRuleId" />
+    <Parameter name="role" />
+  </SqlMethod>
+  <SqlMethod name="updateAlertRuleSql" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+      UPDATE ad_alertrule SET SQL = ? WHERE ad_alertrule_id = ?
+      ]]>
+    </Sql>
+    <Parameter name="sql"/>
+    <Parameter name="adAlertRuleId"/>
+  </SqlMethod>
+  <SqlMethod name="updateAlertStatus" type="preparedStatement" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql><![CDATA[
+      UPDATE ad_alert SET status = ?, isfixed = ? WHERE ad_alert_id = ?
+      ]]>
+    </Sql>
+    <Parameter name="status"/>
+    <Parameter name="isfixed"/>
+    <Parameter name="alertId"/>
+  </SqlMethod>
+</SqlClass>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/InitializeOnHandWarehouse.java	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,40 @@
+/*
+ *************************************************************************
+ * 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) 2012 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+ */
+package org.openbravo.modulescript;
+
+import java.sql.Connection;
+
+import javax.servlet.ServletException;
+
+import org.openbravo.database.ConnectionProvider;
+
+public class InitializeOnHandWarehouse extends ModuleScript {
+  @Override
+  // Updates new column values with deprecated ones
+  public void execute() {
+    try {
+      ConnectionProvider cp = getConnectionProvider();
+      if (!InitializeOnHandWarehouseData.hasOnHandWarehouse(cp.getConnection(), cp)) {
+        InitializeOnHandWarehouseData.initializeOnHandWarehouse(cp.getConnection(), cp);
+      }
+    } catch (Exception e) {
+      handleError(e);
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src-util/modulescript/src/org/openbravo/modulescript/InitializeOnHandWarehouse_data.xsql	Mon Nov 05 17:44:56 2012 +0100
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!--
+ *************************************************************************
+ * 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) 2012 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  ______________________________________.
+ ************************************************************************
+-->
+<SqlClass name="InitializeOnHandWarehouseData" package="org.openbravo.modulescript">
+  <SqlClassComment></SqlClassComment>
+  <SqlMethod name="select" type="preparedStatement" connection="true" return="multiple">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        select '' as name
+        from dual
+      ]]>
+    </Sql>
+  </SqlMethod>
+  <SqlMethod name="hasOnHandWarehouse" type="preparedStatement" connection="true" return="boolean">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        select count(*) as name from dual
+        where exists (select 1 from ad_org_warehouse)
+      ]]>
+    </Sql>
+  </SqlMethod>
+  <SqlMethod name="initializeOnHandWarehouse" type="preparedStatement" connection="true" return="rowcount">
+    <SqlMethodComment></SqlMethodComment>
+    <Sql>
+      <![CDATA[
+        INSERT INTO ad_org_warehouse (
+          ad_org_warehouse_id, ad_client_id, ad_org_id, isactive,
+          created, createdby, updated, updatedby,
+          m_warehouse_id, priority
+        ) 
+          SELECT get_uuid(), wh.ad_client_id, o.ad_org_id, 'Y',
+                now(), '0', now(), '0',
+                wh.m_warehouse_id, 10
+          FROM m_warehouse wh
+              JOIN ad_org o ON ad_org_isinnaturaltree(wh.ad_org_id, o.ad_org_id, wh.ad_client_id) = 'Y'
+              JOIN aD_orgtype ot ON o.ad_orgtype_id = ot.ad_orgtype_id
+          WHERE ot.istransactionsallowed = 'Y'
+      ]]>
+    </Sql>
+  </SqlMethod>
+</SqlClass>