【发布时间】:2021-06-13 17:55:58
【问题描述】:
我们有要求制作分机。即使在发票发布后价格仍可编辑,我们编写了使字段可编辑的逻辑,但是当我们更新值时,我们得到“项目不能为空错误”。我们使用的是 Acumatica 2020 R2 Build - 20.207.0012 和销售演示数据库,没有任何自定义。
这是一个代码示例:
private bool IsDisabled(ARInvoice doc)
{
return doc.Released == true
|| doc.Voided == true
|| doc.DocType == ARDocType.SmallCreditWO
|| doc.PendingPPD == true
|| doc.DocType == ARDocType.FinCharge
&& !Base.IsProcessingMode
&& Base.Document.Cache.GetStatus(doc) == PXEntryStatus.Inserted;
}
protected void ARInvoice_RowSelected(PXCache cache, PXRowSelectedEventArgs e, PXRowSelected InvokeBaseHandler)
{
if(InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var rows= (ARInvoice)e.Row;
if (rows == null)
return;
if (IsDisabled(rows))
{
PXUIFieldAttribute.SetEnabled<ARTran.curyExtPrice>(cache, rows, true);
Base.Document.Cache.AllowUpdate = true;
Base.Transactions.Cache.AllowUpdate = true;
}
}
追踪:
3/16/2021 12:30:41 PM Error:
Error: Updating 'SO Invoice' record raised at least one error. Please review the errors.
Error: 'Project' cannot be empty.
at PX.Data.PXUIFieldAttribute.CommandPreparing(PXCache sender, PXCommandPreparingEventArgs e)
at PX.Data.PXCache.OnCommandPreparing(String name, Object row, Object value, PXDBOperation operation, Type table, FieldDescription& description)
at PX.Data.PXProjectionAttribute.PersistUpdated(PXCache sender, Object row)
at PX.Data.PXCache`1.PersistUpdated(Object row, Boolean bypassInterceptor)
at PX.Data.PXCache`1.Persist(PXDBOperation operation)
at PX.Data.PXGraph.Persist(Type cacheType, PXDBOperation operation)
at PX.Data.PXGraph.Persist()
at PX.Objects.AR.ARInvoiceEntry.Persist()
at PX.Objects.AR.ARInvoiceEntryExternalTax.Persist(Action persist)
at PX.Data.PXSave`1.d__2.MoveNext()
at PX.Data.PXAction`1.d__30.MoveNext()
at PX.Data.PXAction`1.d__30.MoveNext()
at PX.Web.UI.PXBaseDataSource.tryExecutePendingCommand(String viewName, String[] sortcolumns, Boolean[] descendings, Object[] searches, Object[] parameters, PXFilterRow[] filters, DataSourceSelectArguments arguments, Boolean& closeWindowRequired, Int32& adapterStartRow, Int32& adapterTotalRows)
at PX.Web.UI.PXBaseDataSource.ExecuteSelect(String viewName, DataSourceSelectArguments arguments, PXDSSelectArguments pxarguments
【问题讨论】:
-
是 PXUIFieldAttribute.SetEnabled
(cache, rows, true);这给出了我们看不到的问题或代码? -
嗨 JvD,你是对的,这行代码抛出了错误,我们还使一些标题字段可编辑,这些字段可以正常工作,但正如我所说,当我们使行级字段可编辑时,我们遇到这个问题。
标签: acumatica