IDEMPIERE-1842 C_Order.AD_Org_ID Callout for setting warehouse when org is * + Patch / integrate patch from Jan Thielemann

This commit is contained in:
Carlos Ruiz 2014-09-05 16:58:10 -05:00
parent 6ca4902204
commit ddd8c6f6ec
3 changed files with 28 additions and 1 deletions

View File

@ -0,0 +1,3 @@
update ad_column set callout = 'org.compiere.model.CalloutOrder.organization' where ad_column_id = 2163;
SELECT register_migration_script('201409051652_IDEMPIERE-1842.sql') FROM dual;

View File

@ -0,0 +1,3 @@
update ad_column set callout = 'org.compiere.model.CalloutOrder.organization' where ad_column_id = 2163;
SELECT register_migration_script('201409051652_IDEMPIERE-1842.sql') FROM dual;

View File

@ -1374,6 +1374,27 @@ public class CalloutOrder extends CalloutEngine
return "";
} // SalesOrderTenderType
public String organization(Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value){
//Return if Organization field is empty
if(value == null || (Integer)value == 0)
return "";
log.info("Set default Warehouse for Organization " + value + " on Window " + WindowNo);
//Get the current Warehouse
Integer m_warehouse_id = (Integer) mTab.getValue("M_Warehouse_ID");
//Only set Warehouse if the field is empty
if(m_warehouse_id == null || m_warehouse_id == 0){
Integer ad_org_id = (Integer) value;
MOrgInfo orginfo = MOrgInfo.get(ctx, ad_org_id.intValue(), null);
//only set Warehouse if there is a default Warehouse on OrgInfo
if(orginfo!=null && orginfo.getM_Warehouse_ID() != 0)
mTab.setValue("M_Warehouse_ID", orginfo.getM_Warehouse_ID());
}
return "";
}
} // CalloutOrder