IDEMPIERE-1069 Callout doesn’t work the same way in quick entry window and normal AD window.

This commit is contained in:
Richard Morales 2013-06-23 18:00:32 -05:00
parent a35ac9ea7c
commit bc61b7d56c
1 changed files with 33 additions and 2 deletions

View File

@ -31,6 +31,7 @@ import org.compiere.model.GridField;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.GridWindow; import org.compiere.model.GridWindow;
import org.compiere.model.MField; import org.compiere.model.MField;
import org.compiere.model.MQuery;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.model.MTable; import org.compiere.model.MTable;
import org.compiere.model.PO; import org.compiere.model.PO;
@ -235,7 +236,22 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
id = Env.getContextAsInt(Env.getCtx(), parent_WindowNo, columnname); id = Env.getContextAsInt(Env.getCtx(), parent_WindowNo, columnname);
} }
} }
MQuery query = new MQuery(gridtab.getAD_Table_ID());
if (id == 0) { //new record
query.addRestriction("1=2");
gridtab.setQuery(query);
gridtab.query(false);
if (gridtab.isInsertRecord())
gridtab.dataNew(false);
}
else{ //update record
if (gridtab.getTabNo() == 0)
query.addRestriction(gridtab.getKeyColumnName(),"=",id);
gridtab.setQuery(query);
gridtab.query(false);
}
quickTabs.set(idxt, gridtab);
MTable table = MTable.get(Env.getCtx(), gridtab.getTableName()); MTable table = MTable.get(Env.getCtx(), gridtab.getTableName());
PO po = table.getPO(id, null); PO po = table.getPO(id, null);
if (idxt > 0) { if (idxt > 0) {
@ -443,10 +459,25 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
if (idx >= 0) { if (idx >= 0) {
GridField field = quickFields.get(idx); GridField field = quickFields.get(idx);
// process dependencies and callouts for the changed field // process dependencies and callouts for the changed field
field.setValue(evt.getNewValue(), true); field.getGridTab().setValue(field, evt.getNewValue());
field.getGridTab().processFieldChange(field); field.getGridTab().processFieldChange(field);
if (!field.getCallout().isEmpty()) {
refresh();
}
} }
} }
} }
/**
* refresh all fields
*/
public void refresh()
{
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
GridField field = quickFields.get(idxf);
WEditor editor = quickEditors.get(idxf);
editor.setValue(field.getValue());
}
}//refresh
} // WQuickEntry } // WQuickEntry