Question

I want to insert a new product on a purchase requisition and edit the Purch Price but the field is read-only.

I try to unlock the field in the PurchReqTable form but it is already locked.

I try to find some run-time method that lock the field, but I was out of luck.

Any idea?

Was it helpful?

Solution

Have a look at the following method in the PurchReqTable Form:

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());
}

Notice how LineAmount is disabled if the current line contains a non-catalog item. Changing the settings on the datasource or the table will be overridden by this code at runtime. I hope this helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top