Skip to main content
Solved

how can we override abstract class method in acumatica

  • August 26, 2024
  • 1 reply
  • 68 views

I have try to override ShowSplits mehod of LineSplittingExtension abstract class but debugger not coming on my method ShowSplits which I have overirde.

 

 

   
public class EWQCLineSplittingExtension:LineSplittingExtension {
 public static bool IsActive() {
        return EWQCFeatureSetHelper.IsEWQCManufacturingECCFeatureActive();
    }

    //override ShowSplits to update lot on line detail click
    public override IEnumerable ShowSplits(PXAdapter adapter) {

        lsselect.View.AskExt(true);
        //base.showSplits();
        MoveEntry moveEntryGraph = PXGraph.CreateInstance<MoveEntry>();
        EWQCAMMoveEntryExt moveEntryGraphExt = moveEntryGraph.GetExtension<EWQCAMMoveEntryExt>();
        moveEntryGraphExt.InsertLotsInLineDetails(false);

        return adapter.Get();
    }

}

Best answer by Zoltan Febert

Hi @bpatidar72 ,

Your class is not used by Acumatica, try to declare it in the similar way as POReceiptLineSplittingExtension

public class POReceiptLineSplittingExtension : LineSplittingExtension<POReceiptEntry, POReceipt, POReceiptLine, POReceiptLineSplit>

Another solution could be to create an extension of the LineSplittingExtension implementation used by your screen and override the ShowSplits method using [PXOverride].

using System;
using System.Collections;
using PX.Data;
using PX.Objects.PO;
using PX.Objects.PO.GraphExtensions.POReceiptEntryExt;

namespace EWQC;

public class EWQCPOReceiptLineSplittingExtension : PXGraphExtension<POReceiptLineSplittingExtension, POReceiptEntry>
{
    [PXOverride]
    public virtual IEnumerable ShowSplits(PXAdapter adapter, Func<PXAdapter, IEnumerable> baseMethod)
    {
        Base1.lsselect.View.AskExt(true);
        //base.showSplits();
        MoveEntry moveEntryGraph = PXGraph.CreateInstance<MoveEntry>();
        EWQCAMMoveEntryExt moveEntryGraphExt = moveEntryGraph.GetExtension<EWQCAMMoveEntryExt>();
        moveEntryGraphExt.InsertLotsInLineDetails(false);

        return adapter.Get();        
    }
}

 

View original
Did this topic help you find an answer to your question?

1 reply

Zoltan Febert
Jr Varsity I
Forum|alt.badge.img+3
  • Jr Varsity I
  • 176 replies
  • Answer
  • August 26, 2024

Hi @bpatidar72 ,

Your class is not used by Acumatica, try to declare it in the similar way as POReceiptLineSplittingExtension

public class POReceiptLineSplittingExtension : LineSplittingExtension<POReceiptEntry, POReceipt, POReceiptLine, POReceiptLineSplit>

Another solution could be to create an extension of the LineSplittingExtension implementation used by your screen and override the ShowSplits method using [PXOverride].

using System;
using System.Collections;
using PX.Data;
using PX.Objects.PO;
using PX.Objects.PO.GraphExtensions.POReceiptEntryExt;

namespace EWQC;

public class EWQCPOReceiptLineSplittingExtension : PXGraphExtension<POReceiptLineSplittingExtension, POReceiptEntry>
{
    [PXOverride]
    public virtual IEnumerable ShowSplits(PXAdapter adapter, Func<PXAdapter, IEnumerable> baseMethod)
    {
        Base1.lsselect.View.AskExt(true);
        //base.showSplits();
        MoveEntry moveEntryGraph = PXGraph.CreateInstance<MoveEntry>();
        EWQCAMMoveEntryExt moveEntryGraphExt = moveEntryGraph.GetExtension<EWQCAMMoveEntryExt>();
        moveEntryGraphExt.InsertLotsInLineDetails(false);

        return adapter.Get();        
    }
}

 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings