Question

Problem Override method

  • 23 April 2021
  • 2 replies
  • 56 views

Userlevel 1

I’m trying to override a method using this code below 

using System;

using PX.Data;

using PX.Common;

using System.Collections;

using System.Collections.Generic;

using System.Linq;

using PX.Objects.CS;

using PX.Objects.GL;

using PX.Objects.CM;

using PX.Objects.TX;

using PX.Objects.AP;

using PX.Objects.AR;

using PX.Objects.IN;

using PX.Objects.GL.FinPeriods;

using PX.Objects;

using PX.Objects.CA;

namespace PX.Objects.CA

{

    public class CAReleaseProcess_Extension : PXGraphExtension<CAReleaseProcess>

    {

        public delegate IEnumerable<Batch> ReleaseDocProcDelegate<TCADocument>(JournalEntry je, ref List<Batch> batchlist, TCADocument doc)

                where TCADocument : class, ICADocument, new();

        [PXOverride]

        public IEnumerable<Batch> ReleaseDocProc<TCADocument>(JournalEntry je, ref List<Batch> batchlist, TCADocument doc, ReleaseDocProcDelegate<TCADocument> baseMethod)

                where TCADocument : class, ICADocument, new()

        {

            batchlist = new List<Batch>();

            //doc = new TCADocument ();

            return baseMethod(je, ref batchlist, doc);

        }  

    }

}


But I'm getting this error: 


Validating Extensions

Method System.Collections.Generic.IEnumerable`1[PX.Objects.GL.Batch] ReleaseDocProc[TCADocument](PX.Objects.GL.JournalEntry, System.Collections.Generic.List`1[PX.Objects.GL.Batch] ByRef, TCADocument, ReleaseDocProcDelegate`1) in graph extension is marked as [PXOverride], but its signature is not compatible with original method

Validation failed.


2 replies

Userlevel 6
Badge +7

CAReleaseProcess does not contain a ReleaseDocProc method with a generic argument (CAReleaseProcess<TCADocument>), at least not in the official Acumatica release.

The proper override I see on my side is the following:

public delegate IEnumerable<Batch> ReleaseDocProcDelegate(JournalEntry je, ref List<Batch> batchlist, TCADocument doc);
[PXOverride]
public IEnumerable<Batch> ReleaseDocProc(JournalEntry je, ref List<Batch> batchlist, TCADocument doc, ReleaseDocProcDelegate baseMethod)
{
return baseMethod(je,batchlist,doc);
}

 

Userlevel 1

CAReleaseProcess does not contain a ReleaseDocProc method with a generic argument (CAReleaseProcess<TCADocument>), at least not in the official Acumatica release.

The proper override I see on my side is the following:

public delegate IEnumerable<Batch> ReleaseDocProcDelegate(JournalEntry je, ref List<Batch> batchlist, TCADocument doc);
[PXOverride]
public IEnumerable<Batch> ReleaseDocProc(JournalEntry je, ref List<Batch> batchlist, TCADocument doc, ReleaseDocProcDelegate baseMethod)
{
return baseMethod(je,batchlist,doc);
}

 

Thanks Gabriel, but i have this error
 

 

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2020  Acumatica, Inc. All rights reserved