订单完成后启用SOLine字段

时间:2018-11-08 17:25:37

标签: acumatica

我需要为“已完成”状态的销售订单启用“销售人员ID”和“销售订单行的可委托”字段。

我在这里引用了有关在SOOrder标头中启用字段的问题:How to enable CustomerOrderNbr field in Sales Order screen?

我将两个字段添加到“ SO完成”步骤的“自动化步骤”中 Automation Steps Screen

并添加了自定义代码:

$toDelete

但是,这些字段仍然被禁用。有什么我想念的吗?

2 个答案:

答案 0 :(得分:1)

我与一位客户有类似的要求。您在执行自动化步骤时走在正确的轨道上,但是还需要其他一些来启用编辑。这是我们使用的两个事件处理程序:

    protected void SOOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        // Make the promised on ship date field editable even after the order has been completed.
        // This code is not enough to make the feature work - automation steps need to be modified for SO Completed and SO Invoiced to ensure the
        // caches are not disabled.
        sender.AllowUpdate = true;
        Base.Transactions.Cache.AllowUpdate = true;
    }

    protected void SOLine_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
    {
        if (Base.Document.Current != null)
        {
            //Automation steps were modified to keep the transactions grid enabled for the completed status; we are manually disabling it here but leaving the promised on ship date field editable.
            if(Base.Document.Current.Status == SOOrderStatus.Completed)
                PXUIFieldAttribute.SetEnabled(sender, e.Row, false);

            PXUIFieldAttribute.SetEnabled<SOLineExt.usrPromisedShipOnDate>(sender, e.Row, true);
            PXUIFieldAttribute.SetEnabled<SOLineExt.usrLateReasonCode>(sender, e.Row, true);
        }
    }

答案 1 :(得分:0)

要完成此问题的解决方案,在这种情况下,我发现没有必要通过自动化步骤启用完整的销售订单行,然后通过SOLine_RowSelect禁用它。但是,有必要在自动化步骤中添加“销售订单”>“订单Nbr”字段(以使文档“更改销售订单行后保存”可用)。奇怪的是,与其他在更改了同一屏幕或对象的自定义项之后实施该自定义项的项目相比,我们有必要赋予该自定义项一个更高的级别。

Automation Steps example

public class SOOrderEntry_Extension : PXGraphExtension<SOOrderEntry>
{
  protected void SOOrder_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
  {
      sender.AllowUpdate = true;
      Base.Transactions.Cache.AllowUpdate = true;
  }

  protected void SOLine_RowSelected(PXCache sender, PXRowSelectedEventArgs e)
  {
      if (Base.Document.Current != null)
      {
          PXUIFieldAttribute.SetEnabled<SOLine.salesPersonID>(sender, e.Row, true);
          PXUIFieldAttribute.SetEnabled<SOLine.commissionable>(sender, e.Row, true);
      }
  }   
}