更改PurchPrice on dynamics ax 2009采购申请行

时间:2012-08-07 10:13:37

标签: microsoft-dynamics dynamics-ax-2009 ax

我想在采购申请中插入新产品并编辑Purch价格,但该字段为只读。

我尝试解锁PurchReqTable表单中的字段,但它已被锁定。

我试图找到一些锁定字段的运行时方法,但我运气不好。

有什么想法吗?

1 个答案:

答案 0 :(得分:1)

在PurchReqTable表单中查看以下方法:

void setFieldAccess()
{
    boolean allowEdit = purchReqFormMode == PurchReqFormMode::ShowAll ||
                        purchReqLine.LineType == PurchReqLineType::Category ||
                        isUserTaskOwner ||
                        isUserApprovalOwner;
    ;

    purchReqLine_ds.object(fieldnum(PurchReqLine,PriceUnit)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,PurchUnit)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,PurchPrice)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,LineDisc)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,LinePercent)).allowEdit(allowEdit);
    purchReqLine_ds.object(fieldnum(PurchReqLine,PurchMarkup)).allowEdit(allowEdit);

    purchReqLine_ds.object(fieldnum(PurchReqLine,CurrencyCode)).allowEdit(purchReqLine.RecId != 0);
    purchReqLine_ds.object(fieldnum(PurchReqLine,LineAmount)).allowEdit(!purchReqLine.isCatalogItem());
}

注意如果当前行包含非目录项,则如何禁用LineAmount。 在运行时,此代码将覆盖更改数据源或表上的设置。我希望这会有所帮助。