Java
Production
BOM Cost Calculator Service
public class BOMCostService {
/**A model callout class that automatically sets the warehouse (M_Warehouse_ID) based on the selected organization in an order or invoice. Demonstrates the IColumnCallout interface pattern used in iDempiere for field-level business logic triggers.
public class CalloutWarehouseDefault implements IColumnCallout {
@Override
public String start(Properties ctx, int WindowNo,
GridTab mTab, GridField mField,
Object value, Object oldValue) {
if (value == null)
return "";
int orgId = (int) value;
// Find default warehouse for organization
String sql = "SELECT M_Warehouse_ID FROM M_Warehouse "
+ "WHERE AD_Org_ID = ? AND IsActive = 'Y' "
+ "AND IsDefault = 'Y'";
int warehouseId = DB.getSQLValue(null, sql, orgId);
if (warehouseId > 0) {
mTab.setValue("M_Warehouse_ID", warehouseId);
}
return "";
}
}
public class BOMCostService {
/**Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Sales Support Plugin