ADempeireがデフォルトで持っている「製品情報」という名の在庫表は、商品にロットや保障日付等の属性を設定した場合、検索しにくいという弱点があるので、それを改良した「在庫ウィンド」なるものを作成してみる。
1.以下のSQLを実行し、VIEWを作成する。
(下記ビューはadempiere.rv_storageを参考にしています)
CREATE OR REPLACE VIEW adempiere.rv_jastorage AS
SELECT
s.ad_client_id, s.ad_org_id, s.isactive,s.created,s.createdby,s.updated,s.updatedby,
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, s.m_locator_id, l.m_warehouse_id,
l.x, l.y, l.z, s.qtyonhand, s.qtyreserved, s.qtyonhand - s.qtyreserved AS qtyavailable,
s.qtyordered, s.datelastinventory, s.m_attributesetinstance_id,
asi.m_attributeset_id, asi.serno, asi.lot, asi.m_lot_id, asi.guaranteedate,
adempiere.daysbetween(asi.guaranteedate::timestamp with time zone,
adempiere.getdate()) AS shelflifedays,
adempiere.daysbetween(asi.guaranteedate::timestamp with time zone,
adempiere.getdate())::numeric - p.guaranteedaysmin AS goodfordays,
CASE
WHEN COALESCE(p.guaranteedays, 0::numeric) > 0::numeric THEN round(adempiere.daysbetween(asi.guaranteedate::timestamp with time zone, adempiere.getdate())::numeric / p.guaranteedays * 100::numeric, 0)
ELSE NULL::numeric
END AS shelfliferemainingpct
FROM adempiere.m_storage s
JOIN adempiere.m_locator l ON s.m_locator_id = l.m_locator_id
JOIN adempiere.m_product p ON s.m_product_id = p.m_product_id
LEFT JOIN adempiere.m_attributesetinstance asi ON s.m_attributesetinstance_id = asi.m_attributesetinstance_id;
2.下記を参考にadempiere.rv_jastorageのウィンド、メニュー作成する。
http://codezine.jp/article/detail/6367?p=3※ 「テーブルとカラム」ウィンドウで"ビュー"にチェックを入れてください。
すると以下のように在庫ウィンドが作成されます。

なお、余計なカラムはApplication Dictionaryで削ってください。
「ウィンド、タブ&フィールド」ウィンドの"フィールド連続番号"タブで表示するフィールドを選択できます。(表示したくないカラムを左側に移動してやればOKです。表示順位も変更できます。)