Solved

How to fix an error occurred during processing of the field InventoryID: Error: An incorrect type of extension has been requested?

  • 17 November 2022
  • 8 replies
  • 311 views

Userlevel 3
Badge

Hi All,

 

Can you help me about my concern, this is the scenario we do

 

  1. After publishing a customization, Test some procedures from Purchase Order (PO)
  2. Select vendor, In Document Details when I select the InventoryID, and the error suddenly appears and it says “error occurred during processing of the field InventoryID: Error: An incorrect type of extension has been requested ” 
  3. I also checked in Stock Items and all the inventory items are active

 

What should I do next?

 

Thanks

icon

Best answer by Naveen Boga 17 November 2022, 08:20

View original

8 replies

Userlevel 7
Badge +17

Hi @acumaticapm182  I see there is an issue with the code for extending of the DAC. I changed this code like my many places.

Issue Code

 

   POLineExt polinxt = cache.GetExtension<POLineExt>(row);

Fix Code

POLineExt polinxt = row.GetExtension<POLineExt>();

Userlevel 3
Badge

Hi @Naveen Boga 

 

For reference, what part of code you modified here?

Userlevel 7
Badge +17

@acumaticapm182  Glad that I helped you. Thanks for sharing the update!!

Userlevel 3
Badge

Hi @Naveen Boga 

 

Thanks for modifying my codes and the transactions for Purchase Order (Inserting InvetoryID) was successful

 

 

Userlevel 7
Badge +17

@acumaticapm182  Modified a little bit of code again in the above post just now. You can take the latest code from above. 

Userlevel 7
Badge +17

Hi @acumaticapm182  I have modified the code. Please verify with the below code.

 

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using PX.Common;
using PX.Data;
using PX.Objects.GL;
using PX.Objects.CM;
using PX.Objects.CS;
using PX.Objects.CR;
using PX.Objects.TX;
using PX.Objects.IN;
using PX.Objects.EP;
using PX.Objects.AP;
using PX.Objects.AR;
using PX.Objects.SO;
using PX.TM;
using SOOrder = PX.Objects.SO.SOOrder;
using SOLine = PX.Objects.SO.SOLine;
//using Avalara.AvaTax.Adapter;
//using Avalara.AvaTax.Adapter.TaxService;
using PX.Objects.PM;
//using AvaAddress = Avalara.AvaTax.Adapter.AddressService;
//using AvaMessage = Avalara.AvaTax.Adapter.Message;
using CRLocation = PX.Objects.CR.Standalone.Location;
using PX.Objects.AP.MigrationMode;
using PX.Objects.Common;
using PX.Objects;
using PX.Objects.PO;

namespace PX.Objects.PO
{
public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry>
{
#region Event Handlers


public PXSelect<POVendorInventory, Where<POVendorInventory.inventoryID, Equal<Required<POVendorInventory.inventoryID>>,
And<POVendorInventory.vendorID, Equal<Required<POVendorInventory.vendorID>>>>> POVendorInventoryView;

public PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>> InventoryView;

protected void POLine_OrderQty_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
var row = (POLine)e.Row;
CalcMultLevelDisc(cache, row);
}



protected void POLine_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
var row = (POLine)e.Row;
POLineExt polinxt = row.GetExtension<POLineExt>();
POVendorInventory _povendorinv = POVendorInventoryView.SelectSingle(row.InventoryID, Base.Document.Current.VendorID);
if (_povendorinv != null)
{
POVendorInventory povendorinvCache = POVendorInventoryView.Select(row.InventoryID, row.VendorID);
if (povendorinvCache != null)
{
POVendorInventoryExt _povendorinvext = povendorinvCache.GetExtension<POVendorInventoryExt>();
row.GetExtension<POLineExt>().UsrMultilevelDisc = row.GetExtension<POLineExt>().UsrMultilevelDisc;
}
}
else
row.GetExtension<POLineExt>().UsrMultilevelDisc = null;

InventoryItem _stockitem = InventoryView.SelectSingle(row.InventoryID);
PXCache itemCache = InventoryView.Cache;
//InventoryItemExt _itemext = itemCache.GetExtension<InventoryItemExt>(_stockitem);
if (_stockitem.GetExtension<InventoryItemExt>().UsrIsPhyCountRequired != null)
{
if (_stockitem.GetExtension<InventoryItemExt>().UsrIsPhyCountRequired == true)
cache.RaiseExceptionHandling<POLine.inventoryID>(e.Row, ((POLine)e.Row).InventoryID, new PXSetPropertyException("Physical count must be done prior to replenishment", PXErrorLevel.Warning));
}
}


protected void POLine_UsrMultilevelDisc_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
var row = (POLine)e.Row;
CalcMultLevelDisc(cache, row);
}

protected void CalcMultLevelDisc(PXCache cache, POLine row)
{
//POOrder order = Base.Document.Current;
if (row.CuryLineAmt == 0)
return;

//POLineExt polinxt = cache.GetExtension<POLineExt>(row);

if (String.IsNullOrEmpty(row.GetExtension<POLineExt>().UsrMultilevelDisc))
return;

string[] _colstr = row.GetExtension<POLineExt>().UsrMultilevelDisc.Split(',');
decimal? _runamt = row.CuryLineAmt;
foreach (string str in _colstr)
{
_runamt = _runamt - (_runamt * (Convert.ToDecimal(str) / 100M));
}
cache.SetValueExt<POLine.discPct>(row, (((row.CuryLineAmt - _runamt) / row.CuryLineAmt) * 100M));
}



#endregion
}
}

 

Userlevel 3
Badge

Hi @Naveen Boga 

 

This is the code (please see the text file)

Userlevel 7
Badge +17

Hi, @acumaticapm182  This issue is caused by the code, Can you please share the customization code that you added in the Extended Graph code?

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 — 2024  Acumatica, Inc. All rights reserved