diff --git a/db/ddlutils/oracle/views/M_Storage.sql b/db/ddlutils/oracle/views/M_Storage.sql
index bc414b8657..e360a31fc1 100644
--- a/db/ddlutils/oracle/views/M_Storage.sql
+++ b/db/ddlutils/oracle/views/M_Storage.sql
@@ -14,7 +14,7 @@ AS
0 AS qtyordered,
s.datelastinventory,
s.m_attributesetinstance_id,
- s.m_storageonhand_uu
+ s.m_storageonhand_uu AS m_storage_uu
FROM m_storageonhand s
UNION
SELECT sr.m_product_id,
@@ -31,7 +31,7 @@ AS
0 AS qtyordered,
sr.datelastinventory,
sr.m_attributesetinstance_id,
- sr.m_storagereservation_uu
+ sr.m_storagereservation_uu AS m_storage_uu
FROM m_storagereservation sr
JOIN m_warehouse w
ON sr.m_warehouse_id = w.m_warehouse_id
@@ -51,7 +51,7 @@ AS
so.qty AS qtyordered,
so.datelastinventory,
so.m_attributesetinstance_id,
- so.m_storagereservation_uu
+ so.m_storagereservation_uu AS m_storage_uu
FROM m_storagereservation so
JOIN m_warehouse w
ON so.m_warehouse_id = w.m_warehouse_id
diff --git a/db/ddlutils/postgresql/views/M_Storage.sql b/db/ddlutils/postgresql/views/M_Storage.sql
index bc414b8657..e360a31fc1 100644
--- a/db/ddlutils/postgresql/views/M_Storage.sql
+++ b/db/ddlutils/postgresql/views/M_Storage.sql
@@ -14,7 +14,7 @@ AS
0 AS qtyordered,
s.datelastinventory,
s.m_attributesetinstance_id,
- s.m_storageonhand_uu
+ s.m_storageonhand_uu AS m_storage_uu
FROM m_storageonhand s
UNION
SELECT sr.m_product_id,
@@ -31,7 +31,7 @@ AS
0 AS qtyordered,
sr.datelastinventory,
sr.m_attributesetinstance_id,
- sr.m_storagereservation_uu
+ sr.m_storagereservation_uu AS m_storage_uu
FROM m_storagereservation sr
JOIN m_warehouse w
ON sr.m_warehouse_id = w.m_warehouse_id
@@ -51,7 +51,7 @@ AS
so.qty AS qtyordered,
so.datelastinventory,
so.m_attributesetinstance_id,
- so.m_storagereservation_uu
+ so.m_storagereservation_uu AS m_storage_uu
FROM m_storagereservation so
JOIN m_warehouse w
ON so.m_warehouse_id = w.m_warehouse_id
diff --git a/migration/i1.0a-release/oracle/201212031501_IDEMPIERE-385.sql b/migration/i1.0a-release/oracle/201212031501_IDEMPIERE-385.sql
new file mode 100644
index 0000000000..5641c36965
--- /dev/null
+++ b/migration/i1.0a-release/oracle/201212031501_IDEMPIERE-385.sql
@@ -0,0 +1,63 @@
+CREATE OR REPLACE VIEW m_storage
+AS
+ SELECT s.m_product_id,
+ s.m_locator_id,
+ s.ad_client_id,
+ s.ad_org_id,
+ s.isactive,
+ s.created,
+ s.createdby,
+ s.updated,
+ s.updatedby,
+ s.qtyonhand,
+ 0 AS qtyreserved,
+ 0 AS qtyordered,
+ s.datelastinventory,
+ s.m_attributesetinstance_id,
+ s.m_storageonhand_uu AS m_storage_uu
+ FROM m_storageonhand s
+ UNION
+ SELECT sr.m_product_id,
+ w.m_reservelocator_id AS m_locator_id,
+ sr.ad_client_id,
+ sr.ad_org_id,
+ sr.isactive,
+ sr.created,
+ sr.createdby,
+ sr.updated,
+ sr.updatedby,
+ 0 AS qtyonhand,
+ sr.qty AS qtyreserved,
+ 0 AS qtyordered,
+ sr.datelastinventory,
+ sr.m_attributesetinstance_id,
+ sr.m_storagereservation_uu AS m_storage_uu
+ FROM m_storagereservation sr
+ JOIN m_warehouse w
+ ON sr.m_warehouse_id = w.m_warehouse_id
+ WHERE sr.issotrx = 'Y'
+ UNION
+ SELECT so.m_product_id,
+ w.m_reservelocator_id AS m_locator_id,
+ so.ad_client_id,
+ so.ad_org_id,
+ so.isactive,
+ so.created,
+ so.createdby,
+ so.updated,
+ so.updatedby,
+ 0 AS qtyonhand,
+ 0 AS qtyreserved,
+ so.qty AS qtyordered,
+ so.datelastinventory,
+ so.m_attributesetinstance_id,
+ so.m_storagereservation_uu AS m_storage_uu
+ FROM m_storagereservation so
+ JOIN m_warehouse w
+ ON so.m_warehouse_id = w.m_warehouse_id
+ WHERE so.issotrx = 'N'
+;
+
+SELECT register_migration_script('201212031501_IDEMPIERE-385.sql') FROM dual
+;
+
diff --git a/migration/i1.0a-release/oracle/201212031552_IDEMPIERE-246.sql b/migration/i1.0a-release/oracle/201212031552_IDEMPIERE-246.sql
new file mode 100644
index 0000000000..cd1e062f60
--- /dev/null
+++ b/migration/i1.0a-release/oracle/201212031552_IDEMPIERE-246.sql
@@ -0,0 +1,213 @@
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET ColumnSpan=5, SeqNo=40, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59745
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=60,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59740
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=70,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59744
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=80,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59752
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=90,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59743
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=100,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59754
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=110,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62015
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=120,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62016
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=130, IsDisplayed='Y', XPosition=5,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59736
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=160, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62017
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=170, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62018
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=180, IsDisplayed='Y', XPosition=1,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59755
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=190, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59737
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=200,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59748
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=210,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59738
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=220,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59757
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=230,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59758
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=240,Updated=TO_DATE('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59759
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4,Updated=TO_DATE('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61974
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=30,Updated=TO_DATE('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61976
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=40,Updated=TO_DATE('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61977
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=50, IsDisplayed='Y', XPosition=5,Updated=TO_DATE('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61975
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=5,Updated=TO_DATE('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61983
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=61973
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y' WHERE AD_Field_ID=61974
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y' WHERE AD_Field_ID=61976
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y' WHERE AD_Field_ID=61977
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y' WHERE AD_Field_ID=61975
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y' WHERE AD_Field_ID=61978
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y' WHERE AD_Field_ID=61979
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=61980
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=61981
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=61983
+;
+
+-- Dec 3, 2012 3:47:27 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DefaultValue='@$Element_PJ@=''Y''',Updated=TO_DATE('2012-12-03 15:47:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59755
+;
+
+-- Dec 3, 2012 3:47:33 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DefaultValue='@$Element_AY@=''Y''',Updated=TO_DATE('2012-12-03 15:47:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59737
+;
+
+-- Dec 3, 2012 3:47:58 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_MC@=Y',Updated=TO_DATE('2012-12-03 15:47:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59738
+;
+
+-- Dec 3, 2012 3:48:03 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_AY@=''Y''', DefaultValue=NULL,Updated=TO_DATE('2012-12-03 15:48:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59737
+;
+
+-- Dec 3, 2012 3:48:06 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_PJ@=''Y''', DefaultValue=NULL,Updated=TO_DATE('2012-12-03 15:48:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59755
+;
+
+-- Dec 3, 2012 3:48:25 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_OT@=Y',Updated=TO_DATE('2012-12-03 15:48:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59757
+;
+
+-- Dec 3, 2012 3:48:33 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_U1@=Y',Updated=TO_DATE('2012-12-03 15:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59758
+;
+
+-- Dec 3, 2012 3:48:42 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_U1@=Y',Updated=TO_DATE('2012-12-03 15:48:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59759
+;
+
+-- Dec 3, 2012 4:02:02 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Table SET AD_Window_ID=53149,Updated=TO_DATE('2012-12-03 16:02:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=53332
+;
+
+SELECT register_migration_script('201212031552_IDEMPIERE-246.sql') FROM dual
+;
+
diff --git a/migration/i1.0a-release/postgresql/201212031501_IDEMPIERE-385.sql b/migration/i1.0a-release/postgresql/201212031501_IDEMPIERE-385.sql
new file mode 100644
index 0000000000..8ff51bc622
--- /dev/null
+++ b/migration/i1.0a-release/postgresql/201212031501_IDEMPIERE-385.sql
@@ -0,0 +1,280 @@
+ALTER VIEW m_storage RENAME TO m_storage_bad
+;
+
+CREATE OR REPLACE VIEW m_storage
+AS
+ SELECT s.m_product_id,
+ s.m_locator_id,
+ s.ad_client_id,
+ s.ad_org_id,
+ s.isactive,
+ s.created,
+ s.createdby,
+ s.updated,
+ s.updatedby,
+ s.qtyonhand,
+ 0 AS qtyreserved,
+ 0 AS qtyordered,
+ s.datelastinventory,
+ s.m_attributesetinstance_id,
+ s.m_storageonhand_uu AS m_storage_uu
+ FROM m_storageonhand s
+ UNION
+ SELECT sr.m_product_id,
+ w.m_reservelocator_id AS m_locator_id,
+ sr.ad_client_id,
+ sr.ad_org_id,
+ sr.isactive,
+ sr.created,
+ sr.createdby,
+ sr.updated,
+ sr.updatedby,
+ 0 AS qtyonhand,
+ sr.qty AS qtyreserved,
+ 0 AS qtyordered,
+ sr.datelastinventory,
+ sr.m_attributesetinstance_id,
+ sr.m_storagereservation_uu AS m_storage_uu
+ FROM m_storagereservation sr
+ JOIN m_warehouse w
+ ON sr.m_warehouse_id = w.m_warehouse_id
+ WHERE sr.issotrx = 'Y'
+ UNION
+ SELECT so.m_product_id,
+ w.m_reservelocator_id AS m_locator_id,
+ so.ad_client_id,
+ so.ad_org_id,
+ so.isactive,
+ so.created,
+ so.createdby,
+ so.updated,
+ so.updatedby,
+ 0 AS qtyonhand,
+ 0 AS qtyreserved,
+ so.qty AS qtyordered,
+ so.datelastinventory,
+ so.m_attributesetinstance_id,
+ so.m_storagereservation_uu AS m_storage_uu
+ FROM m_storagereservation so
+ JOIN m_warehouse w
+ ON so.m_warehouse_id = w.m_warehouse_id
+ WHERE so.issotrx = 'N'
+;
+
+-- PostgreSQL requires to recreate all views before dropping a table
+CREATE OR REPLACE VIEW RV_STORAGE
+(AD_CLIENT_ID, AD_ORG_ID, M_PRODUCT_ID, VALUE, NAME,
+ DESCRIPTION, UPC, SKU, C_UOM_ID, M_PRODUCT_CATEGORY_ID,
+ CLASSIFICATION, WEIGHT, VOLUME, VERSIONNO, GUARANTEEDAYS,
+ GUARANTEEDAYSMIN, M_LOCATOR_ID, M_WAREHOUSE_ID, X, Y,
+ Z, QTYONHAND, QTYRESERVED, QTYAVAILABLE, QTYORDERED,
+ DATELASTINVENTORY, M_ATTRIBUTESETINSTANCE_ID, M_ATTRIBUTESET_ID, SERNO, LOT,
+ M_LOT_ID, GUARANTEEDATE, SHELFLIFEDAYS, GOODFORDAYS, SHELFLIFEREMAININGPCT)
+AS
+SELECT s.AD_Client_ID, s.AD_Org_ID,
+ -- Product
+ s.M_Product_ID, p.Value,p.Name, p.Description, p.UPC, p.SKU,
+ p.C_UOM_ID, p.M_Product_Category_ID, p.Classification, p.Weight, p.Volume, p.VersionNo,
+ p.GuaranteeDays, p.GuaranteeDaysMin,
+ -- Locator
+ s.M_Locator_ID, l.M_Warehouse_ID, l.X, l.Y, l.Z,
+ -- Storage
+ s.QtyOnHand, s.QtyReserved, s.QtyOnHand-s.QtyReserved AS QtyAvailable,
+ s.QtyOrdered, s.DateLastInventory,
+ -- Instance
+ s.M_AttributeSetInstance_ID, asi.M_AttributeSet_ID, asi.SerNo, asi.Lot, asi.M_Lot_ID,
+ asi.GuaranteeDate, -- see PAttributeInstance.java
+ daysBetween(asi.GuaranteeDate,getdate()) AS ShelfLifeDays,
+ daysBetween(asi.GuaranteeDate,getdate())-p.GuaranteeDaysMin AS GoodForDays,
+ CASE WHEN COALESCE(p.GuaranteeDays,0)>0
+ THEN ROUND((daysBetween(asi.GuaranteeDate,getdate())/p.GuaranteeDays)*100,0)
+ ELSE NULL
+ END AS ShelfLifeRemainingPct
+FROM M_Storage s
+ INNER JOIN M_Locator l ON (s.M_Locator_ID=l.M_Locator_ID)
+ INNER JOIN M_Product p ON (s.M_Product_ID=p.M_Product_ID)
+ LEFT OUTER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID)
+;
+
+CREATE OR REPLACE VIEW rv_pp_order_receipt_issue AS
+SELECT obl.pp_order_bomline_id,
+obl.iscritical,
+p.value,
+obl.m_product_id,
+mos.name AS productname,
+mos.m_attributesetinstance_id,
+asi.description AS instancename,
+mos.c_uom_id,
+u.name AS uomname,
+obl.qtyrequiered,
+obl.qtyreserved AS qtyreserved_order,
+mos.qtyonhand,
+mos.qtyreserved AS qtyreserved_storage,
+mos.qtyavailable,
+mos.m_locator_id,
+mos.m_warehouse_id,
+w.name AS warehousename,
+mos.qtybom,
+mos.isqtypercentage,
+mos.qtybatch,
+obl.componenttype,
+mos.qtyrequiered - obl.qtydelivered AS qtyopen,
+obl.pp_order_id
+FROM rv_pp_order_storage mos
+JOIN pp_order_bomline obl ON mos.pp_order_bomline_id = obl.pp_order_bomline_id
+JOIN m_attributesetinstance asi ON mos.m_attributesetinstance_id = asi.m_attributesetinstance_id
+JOIN c_uom u ON mos.c_uom_id = u.c_uom_id
+JOIN m_product p ON mos.m_product_id = p.m_product_id
+JOIN m_warehouse w ON mos.m_warehouse_id = w.m_warehouse_id
+;
+
+CREATE OR REPLACE VIEW rv_pp_order_storage AS
+SELECT
+obl.ad_client_id,
+obl.ad_org_id,
+obl.createdby,
+obl.updatedby,
+obl.updated,
+obl.created,
+obl.isactive,
+obl.pp_order_bom_id,
+obl.pp_order_bomline_id,
+obl.pp_order_id,
+obl.iscritical,
+obl.m_product_id,
+( SELECT p.name FROM m_product p WHERE p.m_product_id = o.m_product_id) AS name,
+obl.c_uom_id,
+s.qtyonhand,
+round(obl.qtyrequiered, 4) AS qtyrequiered,
+CASE WHEN o.qtybatchs = 0 THEN 1 ELSE round(obl.qtyrequiered / o.qtybatchs, 4) END AS qtybatchsize,
+round(bomqtyreserved(obl.m_product_id,obl.m_warehouse_id, 0), 4) AS qtyreserved,
+round(bomqtyavailable(obl.m_product_id, obl.m_warehouse_id,0), 4) AS qtyavailable,
+obl.m_warehouse_id,
+obl.qtybom,
+obl.isqtypercentage,
+round(obl.qtybatch, 4) AS qtybatch,
+obl.m_attributesetinstance_id,
+l.m_locator_id,
+l.x,
+l.y,
+l.z
+FROM pp_order_bomline obl
+JOIN pp_order o ON o.pp_order_id = obl.pp_order_id
+LEFT JOIN m_storage s ON s.m_product_id = obl.m_product_id AND s.qtyonhand <> 0 AND obl.m_warehouse_id = (( SELECT ld.m_warehouse_id FROM m_locator ld WHERE s.m_locator_id = ld.m_locator_id))
+LEFT JOIN m_locator l ON l.m_locator_id = s.m_locator_id
+ORDER BY obl.m_product_id
+;
+
+CREATE OR REPLACE VIEW rv_storage_per_product AS
+SELECT strg.AD_Client_ID, strg.AD_Org_ID
+ , p.M_Product_ID, p.Value, p.Name
+ , p.Description, p.UPC, p.SKU
+ , p.C_UOM_ID, p.M_Product_Category_ID, p.Classification, p.Weight, p.Volume, p.VersionNo
+ , p.GuaranteeDays, p.GuaranteeDaysMin
+ , strg.SumQtyOnHand
+FROM M_Product p
+ INNER JOIN ( SELECT M_Product_ID, M_Locator_ID, SUM (QtyOnHand) as SumQtyOnHand
+ , AD_Client_ID, AD_Org_ID
+ FROM RV_Storage
+ GROUP BY M_Product_ID, M_Locator_ID, AD_Client_ID, AD_Org_ID) strg ON (p.M_Product_ID = strg.M_Product_ID)
+ INNER JOIN M_Locator l ON (strg.M_Locator_ID=l.M_Locator_ID)
+;
+
+CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V
+AS
+SELECT
+ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy,
+mp.VALUE, mp.help, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand,
+ms.qtyreserved, mp.description, mw.NAME AS warehouse, mw.m_warehouse_id, mw.ad_client_id,
+mw.ad_org_id, mp.documentnote
+FROM M_STORAGE ms
+JOIN M_PRODUCT mp ON ms.m_product_id = mp.m_product_id
+JOIN M_LOCATOR ml ON ms.m_locator_id = ml.m_locator_id
+JOIN M_WAREHOUSE mw ON ml.m_warehouse_id = mw.m_warehouse_id
+ORDER BY mw.NAME;
+
+CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATED_V AS
+SELECT s.ad_client_id,
+ s.ad_org_id,
+ s.isactive,
+ s.created,
+ s.createdby,
+ s.updated,
+ s.updatedby,
+ s.m_product_id,
+ s.substitute_id,
+ 'S' AS rowtype,
+ mp.name,
+ sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
+ sum(ms.qtyonhand) AS qtyonhand,
+ sum(ms.qtyreserved) AS qtyreserved,
+ ROUND(MAX(mpr.pricestd),0) AS pricestd,
+ mpr.m_pricelist_version_id,
+ mw.m_warehouse_id,
+ org.name AS orgname
+ FROM m_substitute s
+ JOIN m_storage ms ON ms.m_product_id = s.substitute_id
+ JOIN m_product mp ON ms.m_product_id = mp.m_product_id
+ JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
+ JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
+ JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
+ JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
+ GROUP BY s.ad_client_id,
+ s.ad_org_id,
+ s.isactive,
+ s.created,
+ s.createdby,
+ s.updated,
+ s.updatedby,
+ s.m_product_id,
+ s.substitute_id,
+ mw.m_warehouse_id,
+ mpr.m_pricelist_version_id,
+ org.name,
+ mp.name
+ UNION
+ SELECT r.ad_client_id,
+ r.ad_org_id,
+ r.isactive,
+ r.created,
+ r.createdby,
+ r.updated,
+ r.updatedby,
+ r.m_product_id,
+ r.relatedproduct_id AS substitute_id,
+ 'R' AS rowtype,
+ mp.name,
+ sum(ms.qtyonhand - ms.qtyreserved) AS qtyavailable,
+ sum(ms.qtyonhand) AS qtyonhand,
+ sum(ms.qtyreserved) AS qtyreserved,
+ ROUND(MAX(mpr.pricestd),0) AS pricestd,
+ mpr.m_pricelist_version_id,
+ mw.m_warehouse_id,
+ org.name AS orgname
+ FROM m_relatedproduct r
+ JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id
+ JOIN m_product mp ON ms.m_product_id = mp.m_product_id
+ JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
+ JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
+ JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
+ JOIN ad_org org ON org.ad_org_id = mw.ad_org_id
+ GROUP BY r.ad_client_id,
+ r.ad_org_id,
+ r.isactive,
+ r.created,
+ r.createdby,
+ r.updated,
+ r.updatedby,
+ r.m_product_id,
+ r.relatedproduct_id,
+ mw.m_warehouse_id,
+ mpr.m_pricelist_version_id,
+ org.name,
+ mp.name;
+
+DROP VIEW m_storage_bad
+;
+
+SELECT register_migration_script('201212031501_IDEMPIERE-385.sql') FROM dual
+;
+
diff --git a/migration/i1.0a-release/postgresql/201212031552_IDEMPIERE-246.sql b/migration/i1.0a-release/postgresql/201212031552_IDEMPIERE-246.sql
new file mode 100644
index 0000000000..32b676bfb2
--- /dev/null
+++ b/migration/i1.0a-release/postgresql/201212031552_IDEMPIERE-246.sql
@@ -0,0 +1,213 @@
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET ColumnSpan=5, SeqNo=40, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59745
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=60,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59740
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=70,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59744
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=80,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59752
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=90,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59743
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=100,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59754
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=110,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62015
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=120,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62016
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=130, IsDisplayed='Y', XPosition=5,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59736
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=160, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62017
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=170, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=62018
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=180, IsDisplayed='Y', XPosition=1,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59755
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=190, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59737
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=200,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59748
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=210,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59738
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=220,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59757
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=230,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59758
+;
+
+-- Dec 3, 2012 3:36:32 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=240,Updated=TO_TIMESTAMP('2012-12-03 15:36:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59759
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=20, IsDisplayed='Y', XPosition=4,Updated=TO_TIMESTAMP('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61974
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=30,Updated=TO_TIMESTAMP('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61976
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=40,Updated=TO_TIMESTAMP('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61977
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=50, IsDisplayed='Y', XPosition=5,Updated=TO_TIMESTAMP('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61975
+;
+
+-- Dec 3, 2012 3:38:37 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNo=100, IsDisplayed='Y', XPosition=5,Updated=TO_TIMESTAMP('2012-12-03 15:38:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=61983
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=0,IsDisplayedGrid='N' WHERE AD_Field_ID=61973
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=10,IsDisplayedGrid='Y' WHERE AD_Field_ID=61974
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=20,IsDisplayedGrid='Y' WHERE AD_Field_ID=61976
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=30,IsDisplayedGrid='Y' WHERE AD_Field_ID=61977
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=40,IsDisplayedGrid='Y' WHERE AD_Field_ID=61975
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=50,IsDisplayedGrid='Y' WHERE AD_Field_ID=61978
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=60,IsDisplayedGrid='Y' WHERE AD_Field_ID=61979
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=70,IsDisplayedGrid='Y' WHERE AD_Field_ID=61980
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=80,IsDisplayedGrid='Y' WHERE AD_Field_ID=61981
+;
+
+-- Dec 3, 2012 3:44:23 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET SeqNoGrid=90,IsDisplayedGrid='Y' WHERE AD_Field_ID=61983
+;
+
+-- Dec 3, 2012 3:47:27 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DefaultValue='@$Element_PJ@=''Y''',Updated=TO_TIMESTAMP('2012-12-03 15:47:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59755
+;
+
+-- Dec 3, 2012 3:47:33 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DefaultValue='@$Element_AY@=''Y''',Updated=TO_TIMESTAMP('2012-12-03 15:47:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59737
+;
+
+-- Dec 3, 2012 3:47:58 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_MC@=Y',Updated=TO_TIMESTAMP('2012-12-03 15:47:58','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59738
+;
+
+-- Dec 3, 2012 3:48:03 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_AY@=''Y''', DefaultValue=NULL,Updated=TO_TIMESTAMP('2012-12-03 15:48:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59737
+;
+
+-- Dec 3, 2012 3:48:06 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_PJ@=''Y''', DefaultValue=NULL,Updated=TO_TIMESTAMP('2012-12-03 15:48:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59755
+;
+
+-- Dec 3, 2012 3:48:25 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_OT@=Y',Updated=TO_TIMESTAMP('2012-12-03 15:48:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59757
+;
+
+-- Dec 3, 2012 3:48:33 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_U1@=Y',Updated=TO_TIMESTAMP('2012-12-03 15:48:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59758
+;
+
+-- Dec 3, 2012 3:48:42 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Field SET DisplayLogic='@$Element_U1@=Y',Updated=TO_TIMESTAMP('2012-12-03 15:48:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59759
+;
+
+-- Dec 3, 2012 4:02:02 PM COT
+-- IDEMPIERE-246 Integrate Manufacturing Light
+UPDATE AD_Table SET AD_Window_ID=53149,Updated=TO_TIMESTAMP('2012-12-03 16:02:02','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Table_ID=53332
+;
+
+SELECT register_migration_script('201212031552_IDEMPIERE-246.sql') FROM dual
+;
+
diff --git a/org.adempiere.server-feature/server.product.launch b/org.adempiere.server-feature/server.product.launch
index 06bf5c626e..26de9579b0 100644
--- a/org.adempiere.server-feature/server.product.launch
+++ b/org.adempiere.server-feature/server.product.launch
@@ -22,7 +22,7 @@
-
+
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java
index 85daf1752f..48ea779551 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java
@@ -23,13 +23,10 @@
package org.adempiere.webui.adwindow;
-import java.util.List;
import java.util.Properties;
import org.adempiere.webui.LayoutUtils;
-import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
-import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.panel.ITabOnCloseHandler;
import org.adempiere.webui.session.SessionManager;
import org.compiere.util.CLogger;
@@ -162,24 +159,9 @@ public class ADWindowContent extends AbstractADWindowContent
class TabOnCloseHanlder implements ITabOnCloseHandler {
public void onClose(Tabpanel tabPanel) {
- if (ADWindowContent.this.onExit()) {
+ if (ADWindowContent.this.onExit()) {
Tab tab = tabPanel.getLinkedTab();
- Tabbox tabbox = (Tabbox) tab.getTabbox();
- if (tabbox.getSelectedTab() == tab) {
- Tabs tabs = (Tabs) tabbox.getTabs();
- List> childs = tabs.getChildren();
- for(int i = 0; i < childs.size(); i++) {
- if (childs.get(i) == tab) {
- if (i > 0)
- tabbox.setSelectedIndex((i-1));
- break;
- }
- }
- } else {
- tabbox.getSelectedPanel().invalidate();
- }
- tabPanel.detach();
- tab.detach();
+ tab.close();
if (getWindowNo() > 0)
SessionManager.getAppDesktop().unregisterWindow(getWindowNo());
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
index 11c4ea3ab8..0eab965c83 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java
@@ -850,15 +850,24 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
EventListener listener = new EventListener() {
@Override
- public void onEvent(Event event) throws Exception {
+ public void onEvent(Event event) throws Exception {
adTabbox.getSelectedGridTab().loadAttachments(); // reload
toolbar.getButton("Attachment").setPressed(adTabbox.getSelectedGridTab().hasAttachment());
- focusToActivePanel();
+ focusToActivePanel();
}
};
// Attachment va =
- new WAttachment ( curWindowNo, adTabbox.getSelectedGridTab().getAD_AttachmentID(),
- adTabbox.getSelectedGridTab().getAD_Table_ID(), record_ID, null, listener);
+ WAttachment win = new WAttachment ( curWindowNo, adTabbox.getSelectedGridTab().getAD_AttachmentID(),
+ adTabbox.getSelectedGridTab().getAD_Table_ID(), record_ID, null, listener);
+ win.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
+ @Override
+ public void onEvent(Event event) throws Exception {
+ Clients.clearBusy(getComponent());
+ }
+ });
+ getComponent().getParent().appendChild(win);
+ Clients.showBusy(getComponent(), " ");
+ LayoutUtils.openOverlappedWindow(getComponent(), win, "middle_center");
}
public void onChat()
@@ -890,12 +899,16 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
WChat chat = new WChat(curWindowNo, adTabbox.getSelectedGridTab().getCM_ChatID(), adTabbox.getSelectedGridTab().getAD_Table_ID(), recordId, description, null);
chat.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
@Override
- public void onEvent(Event event) throws Exception {
+ public void onEvent(Event event) throws Exception {
adTabbox.getSelectedGridTab().loadChats();
toolbar.getButton("Chat").setPressed(adTabbox.getSelectedGridTab().hasChat());
focusToActivePanel();
+ Clients.clearBusy(getComponent());
}
});
+ getComponent().getParent().appendChild(chat);
+ Clients.showBusy(getComponent(), " ");
+ LayoutUtils.openOverlappedWindow(getComponent(), chat, "middle_center");
chat.showWindow();
}
@@ -969,6 +982,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
boolean b = breadCrumb.getStatusError();
onRefresh(true, false);
breadCrumb.setStatusLine(s, b);
+ Clients.clearBusy(getComponent());
}
else if (ADTabpanel.ON_DYNAMIC_DISPLAY_EVENT.equals(event.getName()))
{
@@ -2023,14 +2037,16 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
hbox.setPack("end");
hbox.setHflex("1");
- messagePanel.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
messagePanel.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
@Override
- public void onEvent(Event event) throws Exception {
+ public void onEvent(Event event) throws Exception {
focusToActivePanel();
+ Clients.clearBusy(getComponent());
}
});
- AEnv.showWindow(messagePanel);
+ getComponent().getParent().appendChild(messagePanel);
+ Clients.showBusy(getComponent(), " ");
+ LayoutUtils.openOverlappedWindow(getComponent(), messagePanel, "middle_center");
}
//
@@ -2059,9 +2075,11 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowContent.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true);
if (dialog.isValid()) {
- dialog.setPosition("center");
- dialog.setPage(AbstractADWindowContent.this.getComponent().getPage());
- dialog.doHighlighted();
+ dialog.setWidth("500px");
+ dialog.setBorder("normal");
+ Clients.showBusy(getComponent(), " ");
+ getComponent().getParent().appendChild(dialog);
+ LayoutUtils.openOverlappedWindow(getComponent(), dialog, "middle_center");
}
}
}
@@ -2329,12 +2347,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{
final int recordIdParam = record_ID;
getComponent().getParent().appendChild(win);
- win.setStyle("position: absolute;");
win.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
public void onEvent(Event event) throws Exception {
Clients.clearBusy(getComponent());
if (!win.isStartProcess()) {
- Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, getComponent()));
return;
}
boolean startWOasking = true;
@@ -2360,15 +2376,13 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{
Clients.showBusy(getComponent(), " ");
final WCreateFromWindow window = (WCreateFromWindow) cf.getWindow();
- window.setStyle("position: absolute");
window.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
@Override
- public void onEvent(Event event) throws Exception {
- Clients.clearBusy(getComponent());
+ public void onEvent(Event event) throws Exception {
if (!window.isCancel()) {
onRefresh(true, false);
}
- Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, getComponent()));
+ Clients.clearBusy(getComponent());
}
});
getComponent().getParent().appendChild(window);
@@ -2512,13 +2526,11 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (mode == Mode.HIGHLIGHTED || mode == Mode.MODAL) {
form.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() {
@Override
- public void onEvent(Event event) throws Exception {
- Clients.clearBusy(getComponent());
+ public void onEvent(Event event) throws Exception {
onRefresh(true, false);
- Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, getComponent()));
+ Clients.clearBusy(getComponent());
}
});
- form.setStyle("position: absolute;");
getComponent().getParent().appendChild(form);
Clients.showBusy(getComponent(), " ");
LayoutUtils.openOverlappedWindow(getComponent(), form, "middle_center");
@@ -2533,7 +2545,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (dialog.isValid())
{
- dialog.setStyle("position: absolute;");
dialog.setWidth("500px");
dialog.setBorder("normal");
Clients.showBusy(getComponent(), " ");
@@ -2637,12 +2648,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (Executions.getCurrent() != null)
{
- Clients.clearBusy(getComponent());
if (notPrint) // refresh if not print
{
updateUI(pi);
}
- Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, getComponent()));
}
else
{
@@ -2650,12 +2659,10 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
//acquire desktop, 2 second timeout
Executions.activate(getComponent().getDesktop(), 2000);
try {
- Clients.clearBusy(getComponent());
if (notPrint) // refresh if not print
{
updateUI(pi);
}
- Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, getComponent()));
} catch(Error ex){
throw ex;
} finally{
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java
index 09d7324df4..31168648b3 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java
@@ -17,8 +17,6 @@
package org.adempiere.webui.component;
-import java.util.List;
-
import org.adempiere.webui.panel.ITabOnCloseHandler;
import org.zkoss.zul.Tab;
@@ -66,20 +64,7 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel
onCloseHandler.onClose(this);
else {
Tab tab = this.getLinkedTab();
- Tabbox tabbox = (Tabbox) tab.getTabbox();
- if (tabbox.getSelectedTab() == tab) {
- Tabs tabs = (Tabs) tabbox.getTabs();
- List childs = tabs.getChildren();
- for(int i = 0; i < childs.size(); i++) {
- if (childs.get(i) == tab) {
- if (i > 0)
- tabbox.setSelectedIndex((i-1));
- break;
- }
- }
- }
- this.detach();
- tab.detach();
+ tab.close();
}
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java
index ce66b709f5..ca4d3bbf33 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java
@@ -49,6 +49,7 @@ public class WFilenameEditor extends WEditor
getComponent().setButtonImage("/images/Open16.png");
getComponent().addEventListener(Events.ON_UPLOAD, this);
getComponent().getButton().setUpload("true,native");
+ getComponent().getButton().setAttribute("org.zkoss.zul.image.preload", Boolean.TRUE);
}
@Override
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java
index 5fa8a3008a..b60fe5a172 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java
@@ -186,8 +186,6 @@ public class WAttachment extends Window implements EventListener
Clients.response(new AuScript(null, script));
}
- //enter modal
- doHighlighted();
}
catch (Exception e)
{
@@ -250,6 +248,7 @@ public class WAttachment extends Window implements EventListener
bSave.addEventListener(Events.ON_CLICK, this);
bLoad.setImage("/images/Import24.png");
+ bLoad.setAttribute("org.zkoss.zul.image.preload", Boolean.TRUE);
bLoad.setTooltiptext(Msg.getMsg(Env.getCtx(), "Load"));
bLoad.setUpload("true");
bLoad.addEventListener(Events.ON_UPLOAD, this);
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java
index 742cdf8031..da3a9c5474 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java
@@ -53,6 +53,7 @@ import org.zkoss.util.media.AMedia;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
+import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Div;
import org.zkoss.zul.Filedownload;
import org.zkoss.zul.Hbox;
@@ -93,6 +94,7 @@ public class ReportAction implements EventListener
winReport.setClosable(true);
winReport.setBorder("normal");
winReport.setStyle("position:absolute");
+ winReport.addEventListener("onValidate", this);
cboPrintFormat.setMold("select");
cboPrintFormat.getItems().clear();
@@ -162,7 +164,6 @@ public class ReportAction implements EventListener
confirmPanel.addActionListener(this);
}
- winReport.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED);
LayoutUtils.openPopupWindow(panel.getToolbar().getButton("Report"), winReport, "after_start");
}
@@ -170,8 +171,11 @@ public class ReportAction implements EventListener
public void onEvent(Event event) throws Exception {
if(event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
winReport.onClose();
- else if(event.getTarget().getId().equals(ConfirmPanel.A_OK))
- validate();
+ else if(event.getTarget().getId().equals(ConfirmPanel.A_OK)) {
+ winReport.setVisible(false);
+ Clients.showBusy(panel.getComponent(), null);
+ Events.echoEvent("onValidate", winReport, null);
+ }
else if(event.getTarget() == cboPrintFormat)
{
ListItem li = cboPrintFormat.getSelectedItem();
@@ -183,6 +187,10 @@ public class ReportAction implements EventListener
}
else if(event.getTarget() == chkExport)
cboExportType.setVisible(chkExport.isChecked());
+ else if (event.getName().equals("onValidate")) {
+ validate();
+ Clients.clearBusy(panel.getComponent());
+ }
}
private void validate()
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WChat.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WChat.java
index 2b7beeede9..fd7c45f6ce 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WChat.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WChat.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
-import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Label;
@@ -40,7 +39,6 @@ import org.compiere.util.Util;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
-import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center;
import org.zkoss.zul.Div;
@@ -109,8 +107,6 @@ public class WChat extends Window implements EventListener, DialogEvents
public void showWindow()
{
- this.setAttribute(MODE_KEY, MODE_HIGHLIGHTED);
- AEnv.showWindow(this);
newText.focus();
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java
index d4ea821115..2c08ab83c0 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkJRViewer.java
@@ -2,7 +2,6 @@ package org.adempiere.webui.window;
import java.io.File;
import java.io.FileOutputStream;
-import java.util.List;
import java.util.logging.Level;
import javax.servlet.http.HttpServletRequest;
@@ -18,9 +17,7 @@ import net.sf.jasperreports.engine.export.JRXlsExporterParameter;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.webui.component.Listbox;
-import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
-import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.panel.ITabOnCloseHandler;
import org.adempiere.webui.session.SessionManager;
@@ -222,20 +219,7 @@ public class ZkJRViewer extends Window implements EventListener, ITabOnCl
@Override
public void onClose(Tabpanel tabPanel) {
Tab tab = tabPanel.getLinkedTab();
- Tabbox tabbox = (Tabbox) tab.getTabbox();
- if (tabbox.getSelectedTab() == tab) {
- Tabs tabs = (Tabs) tabbox.getTabs();
- List> childs = tabs.getChildren();
- for(int i = 0; i < childs.size(); i++) {
- if (childs.get(i) == tab) {
- if (i > 0)
- tabbox.setSelectedIndex((i-1));
- break;
- }
- }
- }
- tabPanel.detach();
- tab.detach();
+ tab.close();
cleanUp();
}
diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java
index e04a8b9415..b0424021f6 100644
--- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java
+++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ZkReportViewer.java
@@ -24,7 +24,6 @@ import java.io.StringWriter;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
-import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
@@ -41,9 +40,7 @@ import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
-import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
-import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.DialogEvents;
@@ -615,20 +612,7 @@ public class ZkReportViewer extends Window implements EventListener, ITab
@Override
public void onClose(Tabpanel tabPanel) {
Tab tab = tabPanel.getLinkedTab();
- Tabbox tabbox = (Tabbox) tab.getTabbox();
- if (tabbox.getSelectedTab() == tab) {
- Tabs tabs = (Tabs) tabbox.getTabs();
- List> childs = tabs.getChildren();
- for(int i = 0; i < childs.size(); i++) {
- if (childs.get(i) == tab) {
- if (i > 0)
- tabbox.setSelectedIndex((i-1));
- break;
- }
- }
- }
- tabPanel.detach();
- tab.detach();
+ tab.close();
cleanUp();
}