LSSelect view in Acumatica

Hi all. Today I want to told you about how to override Split Lines on Acumatica screens:

This pop-up used on different screens like SO302000 or S0301000…

Overriding the view in 21 R1 and older versions look like this:

Imagine situation that you want to control this functionality or make automatic allocation on some action. The problem I encountered was that I could not fully override lsselect.

 More precisely, I overloaded but I could not disable the execution of basic logic.

For a sample my task was to make an automatic allocation when user click on save the order and control qty’s on the grid.

After several overloads, I could not control this grid. So I decided to adjust to the basic logic.

Here is a piece of code that I use:

private void SetupAllocation(SOOrderEntry sooRderEntry, SOLine line)
{
 
    SOOrderExt currSoOrderExt = sooRderEntry.Document.Current
        .GetExtension<SOOrderExt>();
    Base.Transactions.Current = line;
 
    foreach (SOLineSplit split in Base.splits.Select())
    {
        // some conditions
        if (split.Completed == false && split.IsAllocated == false)
        {
            SOLineSplit oldLine = PXCache<SOLineSplit>.CreateCopy(split);
 
            decimaldiffQty = 0m;
 
            Base.splits.Cache.RaiseRowUpdated(split, oldLine);
            //qty that we want to allocate
            split.Qty = Base.Transactions.Current.OpenQty;
            split.IsAllocated = true;
            Base.splits.Cache.RaiseRowUpdated(split, oldLine);
            Base.splits.Update(split);
 
 
            // diffQty = //here you can set your value 
 
            Base.splits.Cache.RaiseRowUpdated(split, oldLine);
 
            split.Qty = //first value
                split.IsAllocated = true;
 
            Base.splits.Update(split);
            //if you want to insert new row into the grid     
            if (diffQty > 0)
            {
                SOLineSplit newsplit = new SOLineSplit();
 
                newsplit.LineNbr = split.LineNbr;
                newsplit.Qty = diffQty;
                newsplit.IsAllocated = false;
                Base.splits.Insert(newsplit);
            }
        }
    }
}

 I did something like that. And now I can control automatic or manual allocation also I can control how much qty allocate.

But in the 21R2 version Acumatica changed the code and now for overriding you should do like this:

And I am sure that now will be easier to override and control this panel. In the near future I will do more tests and share the result.

 

 

Add comment

Loading