Skip to main content
Question

How to override a generic method


Hello,

I am trying to add a custom field to the INSiteStatusByCostCenter DAC. I have been able to add the field and have it populated when I create an inventory adjustment. However, when I create an inventory issue, the value of the field is removed from the database. I have tracked it down to two places where I think this is happening but now I am stuck on how to get past it.

 

Problem 1:

In the SiteStatusByCostCenter DAC, the fields have their assign behavior set to summarize in the prepare insert of an Accumulator attribute. Is it possible to do this on my DAC extension?

 

protected override bool PrepareInsert(PXCache cache, object row, PXAccumulatorCollection columns)

{

    if (!base.PrepareInsert(cache, row, columns))

    {

        return false;

    }

    columns.Update<qtyOnHand>(PXDataFieldAssign.AssignBehavior.Summarize);

    columns.Update<qtyAvail>(PXDataFieldAssign.AssignBehavior.Summarize);

    columns.Update<qtyHardAvail>(PXDataFieldAssign.AssignBehavior.Summarize);

    columns.Update<qtyActual>(PXDataFieldAssign.AssignBehavior.Summarize);

    columns.Update<qtyINIssues>(PXDataFieldAssign.AssignBehavior.Summarize);

    columns.Update<qtyINReceipts>(PXDataFieldAssign.AssignBehavior.Summarize);

}

Problem 2:

I have found where the values are set in the code. It is in the Item Plan Helper > UpdateAllocatedQuantitiesBase method. I have overridden the INTranSplit(which implements this class) but I am getting a “The signature of a method with the PXOverride attribute must match the overridden method.” I do not know why this issue is occurring when I copied the parameters from the source code. Here is my code below.

 

public class INIssueEntry3_Extension : PXGraphExtension<IN.GraphExtensions.INRegisterEntryBaseExt.INTranSplitPlan, INRegisterEntryBase>

{

    public delegate TNode UpdateAllocatedQuantitiesBaseDelegate<TNode>(TNode target, IQtyPlanned plan, INPlanType plantype, bool? InclQtyAvail, bool? hold, string refEntityType);

    [PXOverride]

    public TNode UpdateAllocatedQuantitiesBase<TNode>(TNode target, IQtyPlanned plan, INPlanType plantype, bool? InclQtyAvail, bool? hold, string refEntityType, UpdateAllocatedQuantitiesBaseDelegate<SiteStatusByCostCenter> baseMethod)

    {

        PXTrace.WriteInformation("Testing");

        return target;

    }

}

Thank you for your help!

6 replies

darylbowman
Captain II
Forum|alt.badge.img+13

Have you tried UpdateAllocatedQuantitiesBaseDelegate<TNode> baseMethod

public delegate TNode UpdateAllocatedQuantitiesBaseDelegate<TNode>(TNode target, IQtyPlanned plan, INPlanType plantype, bool? InclQtyAvail, bool? hold, string refEntityType);
[PXOverride]
public TNode UpdateAllocatedQuantitiesBase<TNode>(TNode target, IQtyPlanned plan, INPlanType plantype, bool? InclQtyAvail, bool? hold, string refEntityType, UpdateAllocatedQuantitiesBaseDelegate<TNode> baseMethod)
{
    PXTrace.WriteInformation("Testing");
    return target;
}

 


@darylbowman 

I tried this, but I have the same error. 

I am able to override the DefaultValues method in the INTranSplitPlan<TGraph> class but I am unable to override the method in the ItemPlanHelper<Graph> class which the INTranSplitPlan inherits from.

I have tried changing my GraphExtension to the following with no success.

PXGraphExtension<ItemPlanHelper<INRegisterEntryBase>, IN.GraphExtensions.INRegisterEntryBaseExt.INTranSplitPlan, INRegisterEntryBase>

 


darylbowman
Captain II
Forum|alt.badge.img+13

What screen are you using this on?


davidnavasardyan
Jr Varsity I
Forum|alt.badge.img+2

Hi ​@dominicshawhan34  This is a rare situation in your case, but as far as I remember, there is no way to override a generic method from the base graph. I encountered the same issue a few years ago. You can try opening a support case, but I believe there’s not much that can be done.


@darylbowman This is the Inventory Issues screen

 


@davidnavasardyan 

Thank you for this information. Do you know how to set PXDataFieldAssign.AssignBehavior.Summarize on Extension fields? I think this would fix my issue as well.

 

Thanks!


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