Bills and Adjustments 上的禁用字段似乎不起作用
Disabling fields on Bills and Adjustments doesn't seem to work
我在账单和调整上有一个自定义下拉字段,我想确定何时禁用屏幕上的特定字段。我正在使用以下逻辑,它似乎不起作用(注释行也不起作用)。我已经在用户字段上将 commitchanges 设置为 true - 我已经逐步检查代码以确保它被命中:
protected virtual void APInvoice_UsrPOStatus_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
var apr = (APRegister)e.Row;
if (apr == null) return;
var aprext = PXCache<APRegister>.GetExtension<APRegisterExt>(apr);
if (aprext == null) return;
if (aprext.UsrPOstatus != "Open")
{
PXUIFieldAttribute.SetEnabled<APRegister.docType>(sender, apr, false);
PXUIFieldAttribute.SetEnabled<APRegister.refNbr>(sender, apr, false);
//PXUIFieldAttribute.SetEnabled<APInvoice.docType>(Base.Document.Cache, null, false); //(OpenSourceDataDetail.Cache, null, true);
//PXUIFieldAttribute.SetEnabled<APInvoice.refNbr>(Base.Document.Cache, null, false);
}
}
我没有收到任何错误,但什么也没发生。不能禁用这些字段吗?
我也不确定是对这些报表使用 APInvoice 还是 APRegister。
如果无法更改字段启用状态和可见性,通常是因为稍后的事件覆盖了您的更改。
您正在处理的图形扩展的基础图形 (APInvoiceEntry) 在 APInvoice_RowSelected 事件中对这些字段调用 SetEnabled。
要覆盖这些调用,您应该在您的扩展中覆盖相同的事件,然后您的事件处理程序将是最后一个执行的。
protected virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
APInvoice apInvoice = e.Row as APInvoice;
if (apInvoice == null)
{
return;
}
PXUIFieldAttribute.SetEnabled<APInvoice.docType>(cache, apInvoice, false);
PXUIFieldAttribute.SetEnabled<APInvoice.refNbr>(cache, apInvoice, false);
}
我在账单和调整上有一个自定义下拉字段,我想确定何时禁用屏幕上的特定字段。我正在使用以下逻辑,它似乎不起作用(注释行也不起作用)。我已经在用户字段上将 commitchanges 设置为 true - 我已经逐步检查代码以确保它被命中:
protected virtual void APInvoice_UsrPOStatus_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
var apr = (APRegister)e.Row;
if (apr == null) return;
var aprext = PXCache<APRegister>.GetExtension<APRegisterExt>(apr);
if (aprext == null) return;
if (aprext.UsrPOstatus != "Open")
{
PXUIFieldAttribute.SetEnabled<APRegister.docType>(sender, apr, false);
PXUIFieldAttribute.SetEnabled<APRegister.refNbr>(sender, apr, false);
//PXUIFieldAttribute.SetEnabled<APInvoice.docType>(Base.Document.Cache, null, false); //(OpenSourceDataDetail.Cache, null, true);
//PXUIFieldAttribute.SetEnabled<APInvoice.refNbr>(Base.Document.Cache, null, false);
}
}
我没有收到任何错误,但什么也没发生。不能禁用这些字段吗?
我也不确定是对这些报表使用 APInvoice 还是 APRegister。
如果无法更改字段启用状态和可见性,通常是因为稍后的事件覆盖了您的更改。
您正在处理的图形扩展的基础图形 (APInvoiceEntry) 在 APInvoice_RowSelected 事件中对这些字段调用 SetEnabled。
要覆盖这些调用,您应该在您的扩展中覆盖相同的事件,然后您的事件处理程序将是最后一个执行的。
protected virtual void APInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e)
{
APInvoice apInvoice = e.Row as APInvoice;
if (apInvoice == null)
{
return;
}
PXUIFieldAttribute.SetEnabled<APInvoice.docType>(cache, apInvoice, false);
PXUIFieldAttribute.SetEnabled<APInvoice.refNbr>(cache, apInvoice, false);
}