Fixed issue 28001.Add and implement allocated flag in warehouse
authorGorka Ion Damián <gorkaion.damian@openbravo.com>
Tue, 11 Nov 2014 13:26:24 +0100
changeset 25355 4c2831bb988b
parent 25354 acfcd2e5f752
child 25356 56e8074546b0
Fixed issue 28001.Add and implement allocated flag in warehouse

-Add new allocated flag in warehouse. Defaulted to 'N' to keep backward
compatibility.
-Default alloceted flag value in stock reservations in:
-- Automatic reservation process
-- Manage reservation pick and execute
-- Manage prereservation pick and execute
-- MRP Create reservations process
src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml
src-db/database/model/tables/M_WAREHOUSE.xml
src-db/database/model/views/M_PRERESERVATION_PICK_EDIT.xml
src-db/database/sourcedata/AD_COLUMN.xml
src-db/database/sourcedata/AD_FIELD.xml
src/org/openbravo/common/actionhandler/ManagePrereservationActionHandler.java
src/org/openbravo/common/datasource/StockReservationPickAndEditDataSource.java
src/org/openbravo/erpCommon/ad_process/MRPPurchaseCreateReservations.java
--- a/src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml	Fri Nov 07 22:08:50 2014 -0500
+++ b/src-db/database/model/functions/M_RESERVE_STOCK_AUTO.xml	Tue Nov 11 13:26:24 2014 +0100
@@ -22,7 +22,7 @@
 * under the License.
 * The Original Code is Openbravo ERP.
 * The Initial Developer of the Original Code is Openbravo SLU
-* All portions are Copyright (C) 2012 Openbravo SLU
+* All portions are Copyright (C) 2012-2014 Openbravo SLU
 * All Rights Reserved.
 * Contributor(s):  ______________________________________.
 ************************************************************************/
@@ -114,13 +114,16 @@
   
   v_pendingqty := v_pendingtoreserveqty;
   FOR cur_stock IN (
-    SELECT *
-    FROM m_stock_proposed
-    WHERE ad_pinstance_id = v_pinstance_id
-    ORDER BY priority
+    SELECT sp.quantity, sp.m_storage_detail_id, w.isallocated
+    FROM m_stock_proposed sp
+        JOIN m_storage_detail sd ON sd.m_storage_detail_id = sp.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
+    WHERE sp.ad_pinstance_id = v_pinstance_id
+    ORDER BY sp.priority
   ) LOOP
     v_qty := LEAST(cur_stock.quantity, v_pendingqty);
-    M_RESERVE_STOCK_MANUAL(p_reservation_id, 'SD', cur_stock.m_storage_detail_id, v_qty, p_user_id, 'N', v_dummy);
+    M_RESERVE_STOCK_MANUAL(p_reservation_id, 'SD', cur_stock.m_storage_detail_id, v_qty, p_user_id, cur_stock.isallocated, v_dummy);
     v_pendingqty := v_pendingqty - v_qty;
     IF (v_pendingqty <= 0) THEN
       p_reservedqty := v_reserveqty;
--- a/src-db/database/model/tables/M_WAREHOUSE.xml	Fri Nov 07 22:08:50 2014 -0500
+++ b/src-db/database/model/tables/M_WAREHOUSE.xml	Tue Nov 11 13:26:24 2014 +0100
@@ -77,6 +77,10 @@
         <default/>
         <onCreateDefault/>
       </column>
+      <column name="ISALLOCATED" primaryKey="false" required="true" type="CHAR" size="1" autoIncrement="false">
+        <default><![CDATA[N]]></default>
+        <onCreateDefault><![CDATA['N']]></onCreateDefault>
+      </column>
       <foreign-key foreignTable="C_LOCATION" name="C_LOCATION_WAREHOUSE">
         <reference local="C_LOCATION_ID" foreign="C_LOCATION_ID"/>
       </foreign-key>
@@ -96,6 +100,7 @@
         <unique-column name="AD_CLIENT_ID"/>
         <unique-column name="NAME"/>
       </unique>
+      <check name="M_WAREHOUSE_ALLOCATED"><![CDATA[ISALLOCATED IN ('Y', 'N')]]></check>
       <check name="M_WAREHOUSE_ISACTIVE_CHK"><![CDATA[ISACTIVE IN ('Y', 'N')]]></check>
       <check name="M_WAREHOUSE_ISSHIPPER_CHK"><![CDATA[ISSHIPPER IN ('Y', 'N')]]></check>
     </table>
--- a/src-db/database/model/views/M_PRERESERVATION_PICK_EDIT.xml	Fri Nov 07 22:08:50 2014 -0500
+++ b/src-db/database/model/views/M_PRERESERVATION_PICK_EDIT.xml	Tue Nov 11 13:26:24 2014 +0100
@@ -1,4 +1,4 @@
 <?xml version="1.0"?>
   <database name="VIEW M_PRERESERVATION_PICK_EDIT">
-    <view name="M_PRERESERVATION_PICK_EDIT"><![CDATA[SELECT COALESCE(res.m_reservation_stock_id, (sol.c_orderline_id || pol.c_orderline_id)) AS m_prereservation_pick_edit_id, pol.ad_client_id, pol.ad_org_id, pol.createdby, pol.created, pol.updated, pol.updatedby, to_char('Y') AS isactive, pol.c_orderline_id AS purchase_orderline_id, sol.c_orderline_id AS sales_orderline_id, so.documentno, sol.line, so.dateordered, so.datepromised, pol.qtyordered AS purchasedqty, del.qty AS receivedqty, res.quantity AS reservedqty, res.m_reservation_stock_id, CASE WHEN res.m_reservation_stock_id IS NULL THEN 'N' ELSE 'Y' END AS ob_selected, sol.qtyordered, sol.qtydelivered, solres.m_reservation_id, COALESCE(solres.qty, 0) - COALESCE(res.quantity, 0) AS otherresqty, so.c_bpartner_id FROM c_orderline pol JOIN c_order po ON pol.c_order_id = po.c_order_id AND po.issotrx = 'N' AND po.docstatus = 'CO' JOIN c_orderline sol ON pol.m_product_id = sol.m_product_id AND sol.qtyordered <> sol.qtydelivered JOIN c_order so ON sol.c_order_id = so.c_order_id AND so.issotrx = 'Y' AND so.docstatus = 'CO' JOIN (SELECT COALESCE(sum(mp.qty), 0) AS qty, ol.c_orderline_id FROM c_orderline ol JOIN c_order o ON ol.c_order_id = o.c_order_id AND o.issotrx = 'N' AND o.docstatus = 'CO' LEFT JOIN m_matchpo mp ON mp.c_orderline_id = ol.c_orderline_id AND mp.m_inoutline_id IS NOT NULL GROUP BY ol.c_orderline_id) del ON del.c_orderline_id = pol.c_orderline_id AND del.qty <> pol.qtyordered LEFT JOIN (SELECT r.c_orderline_id AS sales_orderline_id, rs.c_orderline_id AS purchase_orderline_id, rs.quantity, rs.m_reservation_stock_id FROM m_reservation r JOIN m_reservation_stock rs ON r.m_reservation_id = rs.m_reservation_id WHERE r.c_orderline_id IS NOT NULL AND rs.c_orderline_id IS NOT NULL AND rs.m_locator_id IS NULL AND r.res_status <> 'CL') res ON res.sales_orderline_id = sol.c_orderline_id AND res.purchase_orderline_id = pol.c_orderline_id LEFT JOIN (SELECT sum(rs.quantity - COALESCE(rs.releasedqty, 0)) AS qty, r.m_reservation_id, r.c_orderline_id, r.quantity AS resqty FROM m_reservation r JOIN m_reservation_stock rs ON r.m_reservation_id = rs.m_reservation_id WHERE r.c_orderline_id IS NOT NULL GROUP BY r.m_reservation_id, r.c_orderline_id, r.quantity) solres ON solres.c_orderline_id = sol.c_orderline_id WHERE (COALESCE(solres.qty, 0) - COALESCE(res.quantity, 0)) <> (sol.qtyordered - sol.qtydelivered)]]></view>
+    <view name="M_PRERESERVATION_PICK_EDIT"><![CDATA[SELECT COALESCE(res.m_reservation_stock_id, (sol.c_orderline_id || pol.c_orderline_id)) AS m_prereservation_pick_edit_id, pol.ad_client_id, pol.ad_org_id, pol.createdby, pol.created, pol.updated, pol.updatedby, to_char('Y') AS isactive, pol.c_orderline_id AS purchase_orderline_id, sol.c_orderline_id AS sales_orderline_id, so.documentno, sol.line, so.dateordered, so.datepromised, pol.qtyordered AS purchasedqty, del.qty AS receivedqty, res.quantity AS reservedqty, res.m_reservation_stock_id, CASE WHEN res.m_reservation_stock_id IS NULL THEN 'N' ELSE 'Y' END AS ob_selected, sol.qtyordered, sol.qtydelivered, solres.m_reservation_id, COALESCE(solres.qty, 0) - COALESCE(res.quantity, 0) AS otherresqty, so.c_bpartner_id, COALESCE(res.isallocated, w.isallocated) AS isallocated FROM c_orderline pol JOIN c_order po ON pol.c_order_id = po.c_order_id AND po.issotrx = 'N' AND po.docstatus = 'CO' JOIN c_orderline sol ON pol.m_product_id = sol.m_product_id AND sol.qtyordered <> sol.qtydelivered JOIN c_order so ON sol.c_order_id = so.c_order_id AND so.issotrx = 'Y' AND so.docstatus = 'CO' JOIN m_warehouse w ON po.m_warehouse_id = w.m_warehouse_id JOIN (SELECT COALESCE(sum(mp.qty), 0) AS qty, ol.c_orderline_id FROM c_orderline ol JOIN c_order o ON ol.c_order_id = o.c_order_id AND o.issotrx = 'N' AND o.docstatus = 'CO' LEFT JOIN m_matchpo mp ON mp.c_orderline_id = ol.c_orderline_id AND mp.m_inoutline_id IS NOT NULL GROUP BY ol.c_orderline_id) del ON del.c_orderline_id = pol.c_orderline_id AND del.qty <> pol.qtyordered LEFT JOIN (SELECT r.c_orderline_id AS sales_orderline_id, rs.c_orderline_id AS purchase_orderline_id, rs.quantity, rs.m_reservation_stock_id, rs.isallocated FROM m_reservation r JOIN m_reservation_stock rs ON r.m_reservation_id = rs.m_reservation_id WHERE r.c_orderline_id IS NOT NULL AND rs.c_orderline_id IS NOT NULL AND rs.m_locator_id IS NULL AND r.res_status <> 'CL') res ON res.sales_orderline_id = sol.c_orderline_id AND res.purchase_orderline_id = pol.c_orderline_id LEFT JOIN (SELECT sum(rs.quantity - COALESCE(rs.releasedqty, 0)) AS qty, r.m_reservation_id, r.c_orderline_id, r.quantity AS resqty FROM m_reservation r JOIN m_reservation_stock rs ON r.m_reservation_id = rs.m_reservation_id WHERE r.c_orderline_id IS NOT NULL GROUP BY r.m_reservation_id, r.c_orderline_id, r.quantity) solres ON solres.c_orderline_id = sol.c_orderline_id WHERE (COALESCE(solres.qty, 0) - COALESCE(res.quantity, 0)) <> (sol.qtyordered - sol.qtydelivered)]]></view>
   </database>
--- a/src-db/database/sourcedata/AD_COLUMN.xml	Fri Nov 07 22:08:50 2014 -0500
+++ b/src-db/database/sourcedata/AD_COLUMN.xml	Tue Nov 11 13:26:24 2014 +0100
@@ -225167,6 +225167,75 @@
 <!--05C58E74CB76448CBA4AF4CA43E193E3-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
 <!--05C58E74CB76448CBA4AF4CA43E193E3--></AD_COLUMN>
 
+<!--06005FA088FD93DAE050007F01006246--><AD_COLUMN>
+<!--06005FA088FD93DAE050007F01006246-->  <AD_COLUMN_ID><![CDATA[06005FA088FD93DAE050007F01006246]]></AD_COLUMN_ID>
+<!--06005FA088FD93DAE050007F01006246-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--06005FA088FD93DAE050007F01006246-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--06005FA088FD93DAE050007F01006246-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--06005FA088FD93DAE050007F01006246-->  <NAME><![CDATA[Allocated]]></NAME>
+<!--06005FA088FD93DAE050007F01006246-->  <HELP><![CDATA[An Allocated Reservation Stock means that the referenced stock and quantity can only be used to fulfill this Reservation.]]></HELP>
+<!--06005FA088FD93DAE050007F01006246-->  <COLUMNNAME><![CDATA[Isallocated]]></COLUMNNAME>
+<!--06005FA088FD93DAE050007F01006246-->  <AD_TABLE_ID><![CDATA[190]]></AD_TABLE_ID>
+<!--06005FA088FD93DAE050007F01006246-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--06005FA088FD93DAE050007F01006246-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--06005FA088FD93DAE050007F01006246-->  <DEFAULTVALUE><![CDATA[N]]></DEFAULTVALUE>
+<!--06005FA088FD93DAE050007F01006246-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--06005FA088FD93DAE050007F01006246-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--06005FA088FD93DAE050007F01006246-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--06005FA088FD93DAE050007F01006246-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--06005FA088FD93DAE050007F01006246-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--06005FA088FD93DAE050007F01006246-->  <SEQNO><![CDATA[71]]></SEQNO>
+<!--06005FA088FD93DAE050007F01006246-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--06005FA088FD93DAE050007F01006246-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--06005FA088FD93DAE050007F01006246-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--06005FA088FD93DAE050007F01006246-->  <AD_ELEMENT_ID><![CDATA[CA9E531DC5F9EB11E040007F0100672C]]></AD_ELEMENT_ID>
+<!--06005FA088FD93DAE050007F01006246-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--06005FA088FD93DAE050007F01006246-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--06005FA088FD93DAE050007F01006246-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--06005FA088FD93DAE050007F01006246-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--06005FA088FD93DAE050007F01006246-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--06005FA088FD93DAE050007F01006246-->  <POSITION><![CDATA[20]]></POSITION>
+<!--06005FA088FD93DAE050007F01006246-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--06005FA088FD93DAE050007F01006246-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--06005FA088FD93DAE050007F01006246-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--06005FA088FD93DAE050007F01006246-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--06005FA088FD93DAE050007F01006246-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--06005FA088FD93DAE050007F01006246--></AD_COLUMN>
+
+<!--06018F3A50D9AE33E050007F010021AE--><AD_COLUMN>
+<!--06018F3A50D9AE33E050007F010021AE-->  <AD_COLUMN_ID><![CDATA[06018F3A50D9AE33E050007F010021AE]]></AD_COLUMN_ID>
+<!--06018F3A50D9AE33E050007F010021AE-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--06018F3A50D9AE33E050007F010021AE-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--06018F3A50D9AE33E050007F010021AE-->  <NAME><![CDATA[Allocated]]></NAME>
+<!--06018F3A50D9AE33E050007F010021AE-->  <HELP><![CDATA[An Allocated Reservation Stock means that the referenced stock and quantity can only be used to fulfill this Reservation.]]></HELP>
+<!--06018F3A50D9AE33E050007F010021AE-->  <COLUMNNAME><![CDATA[Isallocated]]></COLUMNNAME>
+<!--06018F3A50D9AE33E050007F010021AE-->  <AD_TABLE_ID><![CDATA[37E387BC8B4F4906B6D653ACAE690A1E]]></AD_TABLE_ID>
+<!--06018F3A50D9AE33E050007F010021AE-->  <AD_REFERENCE_ID><![CDATA[20]]></AD_REFERENCE_ID>
+<!--06018F3A50D9AE33E050007F010021AE-->  <FIELDLENGTH><![CDATA[1]]></FIELDLENGTH>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISKEY><![CDATA[N]]></ISKEY>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISPARENT><![CDATA[N]]></ISPARENT>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISMANDATORY><![CDATA[Y]]></ISMANDATORY>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISUPDATEABLE><![CDATA[Y]]></ISUPDATEABLE>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISIDENTIFIER><![CDATA[N]]></ISIDENTIFIER>
+<!--06018F3A50D9AE33E050007F010021AE-->  <SEQNO><![CDATA[260]]></SEQNO>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISTRANSLATED><![CDATA[N]]></ISTRANSLATED>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISSELECTIONCOLUMN><![CDATA[N]]></ISSELECTIONCOLUMN>
+<!--06018F3A50D9AE33E050007F010021AE-->  <AD_ELEMENT_ID><![CDATA[CA9E531DC5F9EB11E040007F0100672C]]></AD_ELEMENT_ID>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISSESSIONATTR><![CDATA[N]]></ISSESSIONATTR>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISSECONDARYKEY><![CDATA[N]]></ISSECONDARYKEY>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISDESENCRYPTABLE><![CDATA[N]]></ISDESENCRYPTABLE>
+<!--06018F3A50D9AE33E050007F010021AE-->  <DEVELOPMENTSTATUS><![CDATA[RE]]></DEVELOPMENTSTATUS>
+<!--06018F3A50D9AE33E050007F010021AE-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--06018F3A50D9AE33E050007F010021AE-->  <POSITION><![CDATA[25]]></POSITION>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISTRANSIENT><![CDATA[N]]></ISTRANSIENT>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISAUTOSAVE><![CDATA[Y]]></ISAUTOSAVE>
+<!--06018F3A50D9AE33E050007F010021AE-->  <VALIDATEONNEW><![CDATA[Y]]></VALIDATEONNEW>
+<!--06018F3A50D9AE33E050007F010021AE-->  <IMAGESIZEVALUESACTION><![CDATA[N]]></IMAGESIZEVALUESACTION>
+<!--06018F3A50D9AE33E050007F010021AE-->  <ISUSEDSEQUENCE><![CDATA[N]]></ISUSEDSEQUENCE>
+<!--06018F3A50D9AE33E050007F010021AE--></AD_COLUMN>
+
 <!--060657E87C824FD29A132A97802331F1--><AD_COLUMN>
 <!--060657E87C824FD29A132A97802331F1-->  <AD_COLUMN_ID><![CDATA[060657E87C824FD29A132A97802331F1]]></AD_COLUMN_ID>
 <!--060657E87C824FD29A132A97802331F1-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src-db/database/sourcedata/AD_FIELD.xml	Fri Nov 07 22:08:50 2014 -0500
+++ b/src-db/database/sourcedata/AD_FIELD.xml	Tue Nov 11 13:26:24 2014 +0100
@@ -12860,7 +12860,7 @@
 <!--997-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
 <!--997-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
 <!--997-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
-<!--997-->  <SEQNO><![CDATA[70]]></SEQNO>
+<!--997-->  <SEQNO><![CDATA[80]]></SEQNO>
 <!--997-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
 <!--997-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
 <!--997-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
@@ -179631,6 +179631,35 @@
 <!--05A05505FBF14040A661CE3A51417DAC-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--05A05505FBF14040A661CE3A51417DAC--></AD_FIELD>
 
+<!--06005FA0890493DAE050007F01006246--><AD_FIELD>
+<!--06005FA0890493DAE050007F01006246-->  <AD_FIELD_ID><![CDATA[06005FA0890493DAE050007F01006246]]></AD_FIELD_ID>
+<!--06005FA0890493DAE050007F01006246-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--06005FA0890493DAE050007F01006246-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--06005FA0890493DAE050007F01006246-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--06005FA0890493DAE050007F01006246-->  <NAME><![CDATA[Allocated]]></NAME>
+<!--06005FA0890493DAE050007F01006246-->  <HELP><![CDATA[When the system automatically reserves stock of this warehouse it will be allocated or not based on this flag.]]></HELP>
+<!--06005FA0890493DAE050007F01006246-->  <ISCENTRALLYMAINTAINED><![CDATA[N]]></ISCENTRALLYMAINTAINED>
+<!--06005FA0890493DAE050007F01006246-->  <AD_TAB_ID><![CDATA[177]]></AD_TAB_ID>
+<!--06005FA0890493DAE050007F01006246-->  <AD_COLUMN_ID><![CDATA[06005FA088FD93DAE050007F01006246]]></AD_COLUMN_ID>
+<!--06005FA0890493DAE050007F01006246-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--06005FA0890493DAE050007F01006246-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--06005FA0890493DAE050007F01006246-->  <DISPLAYLOGIC><![CDATA[@StockReservations@!'']]></DISPLAYLOGIC>
+<!--06005FA0890493DAE050007F01006246-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--06005FA0890493DAE050007F01006246-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--06005FA0890493DAE050007F01006246-->  <SEQNO><![CDATA[70]]></SEQNO>
+<!--06005FA0890493DAE050007F01006246-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--06005FA0890493DAE050007F01006246-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--06005FA0890493DAE050007F01006246-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--06005FA0890493DAE050007F01006246-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--06005FA0890493DAE050007F01006246-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--06005FA0890493DAE050007F01006246-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--06005FA0890493DAE050007F01006246-->  <GRID_SEQNO><![CDATA[70]]></GRID_SEQNO>
+<!--06005FA0890493DAE050007F01006246-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--06005FA0890493DAE050007F01006246-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--06005FA0890493DAE050007F01006246-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--06005FA0890493DAE050007F01006246-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--06005FA0890493DAE050007F01006246--></AD_FIELD>
+
 <!--06119ABE11644B2B8CD67F7DC4C96891--><AD_FIELD>
 <!--06119ABE11644B2B8CD67F7DC4C96891-->  <AD_FIELD_ID><![CDATA[06119ABE11644B2B8CD67F7DC4C96891]]></AD_FIELD_ID>
 <!--06119ABE11644B2B8CD67F7DC4C96891-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
@@ -183238,6 +183267,33 @@
 <!--119FCD6CC06F43E6BE4DA88BC1368A4D-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
 <!--119FCD6CC06F43E6BE4DA88BC1368A4D--></AD_FIELD>
 
+<!--11C516B1076A4C6A9356851CA71498F3--><AD_FIELD>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <AD_FIELD_ID><![CDATA[11C516B1076A4C6A9356851CA71498F3]]></AD_FIELD_ID>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <AD_ORG_ID><![CDATA[0]]></AD_ORG_ID>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISACTIVE><![CDATA[Y]]></ISACTIVE>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <NAME><![CDATA[Allocated]]></NAME>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <HELP><![CDATA[An Allocated Reservation Stock means that the referenced stock and quantity can only be used to fulfill this Reservation.]]></HELP>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISCENTRALLYMAINTAINED><![CDATA[Y]]></ISCENTRALLYMAINTAINED>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <AD_TAB_ID><![CDATA[F03F2C664800458CAEFF50DECB3A7FFE]]></AD_TAB_ID>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <AD_COLUMN_ID><![CDATA[06018F3A50D9AE33E050007F010021AE]]></AD_COLUMN_ID>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <IGNOREINWAD><![CDATA[N]]></IGNOREINWAD>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISDISPLAYED><![CDATA[Y]]></ISDISPLAYED>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <DISPLAYLENGTH><![CDATA[1]]></DISPLAYLENGTH>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISREADONLY><![CDATA[N]]></ISREADONLY>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <SEQNO><![CDATA[90]]></SEQNO>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISSAMELINE><![CDATA[N]]></ISSAMELINE>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISFIELDONLY><![CDATA[N]]></ISFIELDONLY>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISENCRYPTED><![CDATA[N]]></ISENCRYPTED>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <SHOWINRELATION><![CDATA[Y]]></SHOWINRELATION>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISFIRSTFOCUSEDFIELD><![CDATA[N]]></ISFIRSTFOCUSEDFIELD>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <AD_MODULE_ID><![CDATA[0]]></AD_MODULE_ID>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <STARTINODDCOLUMN><![CDATA[N]]></STARTINODDCOLUMN>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <STARTNEWLINE><![CDATA[N]]></STARTNEWLINE>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <ISSHOWNINSTATUSBAR><![CDATA[N]]></ISSHOWNINSTATUSBAR>
+<!--11C516B1076A4C6A9356851CA71498F3-->  <EM_OBUIAPP_SHOWSUMMARY><![CDATA[N]]></EM_OBUIAPP_SHOWSUMMARY>
+<!--11C516B1076A4C6A9356851CA71498F3--></AD_FIELD>
+
 <!--11CD099503E147538CD4520E2EE10C04--><AD_FIELD>
 <!--11CD099503E147538CD4520E2EE10C04-->  <AD_FIELD_ID><![CDATA[11CD099503E147538CD4520E2EE10C04]]></AD_FIELD_ID>
 <!--11CD099503E147538CD4520E2EE10C04-->  <AD_CLIENT_ID><![CDATA[0]]></AD_CLIENT_ID>
--- a/src/org/openbravo/common/actionhandler/ManagePrereservationActionHandler.java	Fri Nov 07 22:08:50 2014 -0500
+++ b/src/org/openbravo/common/actionhandler/ManagePrereservationActionHandler.java	Tue Nov 11 13:26:24 2014 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2012 Openbravo SLU 
+ * All portions are Copyright (C) 2012-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -134,6 +134,9 @@
 
       final BigDecimal qty = new BigDecimal(
           selectedLine.getString(PrereservationManualPickEdit.PROPERTY_RESERVEDQTY));
+      final boolean allocated = selectedLine
+          .getBoolean(PrereservationManualPickEdit.PROPERTY_ALLOCATED);
+      resStock.setAllocated(allocated);
       resStock.setQuantity(qty);
 
       OBDal.getInstance().save(resStock);
--- a/src/org/openbravo/common/datasource/StockReservationPickAndEditDataSource.java	Fri Nov 07 22:08:50 2014 -0500
+++ b/src/org/openbravo/common/datasource/StockReservationPickAndEditDataSource.java	Tue Nov 11 13:26:24 2014 +0100
@@ -965,7 +965,8 @@
         continue;
       }
       if (StringUtils.isNotBlank(allocatedCriteria)
-          && !isInScope("allocated", allocatedCriteria, false)) {
+          && !isInScope("allocated", allocatedCriteria, orderLine.getSalesOrder().getWarehouse()
+              .isAllocated())) {
         continue;
       }
 
@@ -975,7 +976,7 @@
       myMap.put("quantity", BigDecimal.ZERO);
       myMap.put("reservationQuantity", reservation.getQuantity());
       myMap.put("released", BigDecimal.ZERO);
-      myMap.put("allocated", false);
+      myMap.put("allocated", orderLine.getSalesOrder().getWarehouse().isAllocated());
       result.add(myMap);
     }
     return result;
@@ -1088,7 +1089,8 @@
               continue;
             }
             if (StringUtils.isNotBlank(allocatedCriteria)
-                && !isInScope("allocated", allocatedCriteria, false)) {
+                && !isInScope("allocated", allocatedCriteria, sd.getStorageBin().getWarehouse()
+                    .isAllocated())) {
               continue;
             }
             result = tomap(sd, false, result, reservedinothers, reservation);
@@ -1112,7 +1114,8 @@
           continue;
         }
         if (StringUtils.isNotBlank(allocatedCriteria)
-            && !isInScope("allocated", allocatedCriteria, false)) {
+            && !isInScope("allocated", allocatedCriteria, sd.getStorageBin().getWarehouse()
+                .isAllocated())) {
           continue;
         }
         result = tomap(sd, false, result, reservedinothers, reservation);
@@ -1147,7 +1150,7 @@
     myMap.put("reservationQuantity", reservation.getQuantity());
     myMap.put("quantity", BigDecimal.ZERO);
     myMap.put("released", BigDecimal.ZERO);
-    myMap.put("allocated", false);
+    myMap.put("allocated", sd.getStorageBin().getWarehouse().isAllocated());
     result.add(myMap);
 
     return result;
--- a/src/org/openbravo/erpCommon/ad_process/MRPPurchaseCreateReservations.java	Fri Nov 07 22:08:50 2014 -0500
+++ b/src/org/openbravo/erpCommon/ad_process/MRPPurchaseCreateReservations.java	Tue Nov 11 13:26:24 2014 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2012-2013 Openbravo SLU 
+ * All portions are Copyright (C) 2012-2014 Openbravo SLU 
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -137,7 +137,8 @@
               if (incomingLine.getTransactionType().equals("PP")
                   && incomingLine.getSalesOrderLine() != null) {
                 ReservationUtils.reserveStockManual(reservation, incomingLine.getSalesOrderLine(),
-                    consumedQuantity, "N");
+                    consumedQuantity, incomingLine.getSalesOrderLine().getSalesOrder()
+                        .getWarehouse().isAllocated() ? "Y" : "N");
               }
 
               if (quantity.signum() < 1 && reservation.getRESStatus().equals("DR")) {
@@ -216,4 +217,4 @@
       throw new OBException(OBMessageUtils.parseTranslation(t.getMessage()), t);
     }
   }
-}
\ No newline at end of file
+}