diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 909348cb31..8f3c6ad9d0 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -1582,6 +1582,17 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable return m_vo.IsInsertRecord; } // isInsertRecord + /** + * Can we Delete Records? + * @return true not read only and allowed + */ + public boolean isDeleteRecord() + { + if (isReadOnly()) + return false; + return m_vo.IsDeleteable; + } // isDeleteRecord + /** * Is the Tab Visible. * Called when constructing the window. diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java index 58d1f7eed7..3ae63b1d01 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java @@ -1231,12 +1231,15 @@ public final class APanel extends CPanel changed = false; boolean readOnly = m_curTab.isReadOnly(); boolean insertRecord = !readOnly; + boolean deleteRecord = !readOnly; if (insertRecord) insertRecord = m_curTab.isInsertRecord(); aNew.setEnabled(!changed && insertRecord); aCopy.setEnabled(!changed && insertRecord); aRefresh.setEnabled(!changed); - aDelete.setEnabled(!changed && !readOnly); + if (deleteRecord) + deleteRecord = m_curTab.isDeleteRecord(); + aDelete.setEnabled(!changed && deleteRecord); aDeleteSelection.setEnabled(!changed && !readOnly); // if (readOnly && m_curTab.isAlwaysUpdateField()) 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 96f6b8d552..5fb7ab0eab 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 @@ -1532,6 +1532,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements boolean readOnly = adTabbox.getSelectedGridTab().isReadOnly(); boolean processed = adTabbox.getSelectedGridTab().isProcessed(); boolean insertRecord = !readOnly; + boolean deleteRecord = !readOnly; if (!detailTab) { // update Change @@ -1544,7 +1545,11 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements toolbar.enableNew(!changed && insertRecord && !tabPanel.getGridTab().isSortTab()); toolbar.enableCopy(!changed && insertRecord && !tabPanel.getGridTab().isSortTab() && adTabbox.getSelectedGridTab().getRowCount()>0); toolbar.enableRefresh(!changed); - toolbar.enableDelete(!changed && !readOnly && !tabPanel.getGridTab().isSortTab() && !processed); + if (deleteRecord) + { + deleteRecord = tabPanel.getGridTab().isDeleteRecord(); + } + toolbar.enableDelete(!changed && deleteRecord && !tabPanel.getGridTab().isSortTab() && !processed); // if (readOnly && adTabbox.getSelectedGridTab().isAlwaysUpdateField()) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java index 06b63068ed..41771344da 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java @@ -664,12 +664,18 @@ public class DetailPane extends Panel implements EventListener, IdSpace { readOnly = true; boolean insertRecord = !readOnly; + boolean deleteRecord = !readOnly; + if (insertRecord) { insertRecord = adtab.getGridTab().isInsertRecord(); } boolean enableNew = !changed && insertRecord && !adtab.getGridTab().isSortTab(); - boolean enableDelete = !changed && !readOnly && !adtab.getGridTab().isSortTab(); + if (deleteRecord) + { + deleteRecord = adtab.getGridTab().isDeleteRecord(); + } + boolean enableDelete = !changed && deleteRecord && !adtab.getGridTab().isSortTab(); ADWindow adwindow = ADWindow.findADWindow(this); if (adwindow == null)