简体   繁体   中英

How to stop adding new SOLines in Sales Orders Screen according to a condition in Acumatica

I want to stop adding new lines to a sales order based on a condition in Acumatica . How can I do this.?

I tried adding the following. But It did not worked.

protected void SOLine_RowInserting(PXCache cache, PXRowInsertingEventArgs e) {

        var row = (SOLine)e.Row;

        if (row == null) return;

        //Condition

        if(Condition == true)

       {

                   Base.Transaction.Delete(row);

        }

}

Set AllowInsert cache property to false from the context of RowSelected event.

void _(Events.RowSelected<SOLine> e, PXRowSelected baseMethod)
{
    baseMethod(e.Cache, e.Args);

    bool canInsertCondition = false;
    Base.Transaction.Cache.AllowInsert = canInsertCondition;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM