【问题标题】:"Project cannot be empty" in Invoice and Memos screen发票和备忘录屏幕中的“项目不能为空”
【发布时间】: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


【解决方案1】:

我认为您最好的选择是将该字段添加到您的屏幕并检查值是什么:

那么也可以像这样尝试抑制错误:

namespace PX.Objects.SO
{
  public class SOInvoiceEntry_Extension : PXGraphExtension<SOInvoiceEntry>
  {
    #region Event Handlers

    protected void ARTran_ProjectID_FieldVerifying(PXCache cache, PXFieldVerifyingEventArgs e)
    {
      
      e.Cancel = true;
      
    }

    #endregion
  }
}

【讨论】:

  • 感谢 Input JvD,会检查并通知您。
猜你喜欢
  • 2021-03-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-12
  • 1970-01-01
  • 1970-01-01
  • 2017-07-20
相关资源
最近更新 更多