We have a custom processing screen for creating kit assemblies that has stopped working after the upgrade to 2022R1.
The code: (I added lines to attempt to set the Tran Date and Financial Period; the date is getting set but the FinPeriod lines have no effect)
protected virtual void GenerateKitAssembly(KitAssemblyEntry kitGraph, ProcessKitAssemblyItemInfoPX soline)
{
kitGraph.Clear();
INKitRegister doc = PXCache<INKitRegister>.CreateCopy(kitGraph.Document.Insert(new INKitRegister()));
doc.InventoryID = soline.InventoryID;
doc.KitRevisionID = soline.KitRevisionID;
doc.Qty = soline.AssemblyQty;
doc.UOM = soline.UOM;
doc.Hold = true;
doc.Status = INDocStatus.Hold;
doc.BranchID = soline.BranchID;
doc.TranBranchID = soline.BranchID;
doc.TranDate = DateTime.Now;
doc.TranTranDate = DateTime.Now;
doc.FinPeriodID = DateTime.Now.ToString("yyyyMM");
doc.TranFinPeriodID = DateTime.Now.ToString("yyyyMM");
doc.TranPeriodID = DateTime.Now.ToString("yyyyMM");
doc.TranTranPeriodID = DateTime.Now.ToString("yyyyMM");
doc.SiteID = soline.SiteID;
doc.GetExtension<INKitRegisterExt>().UsrManualProcess = soline.RoboticsFulfill == null ? true : !soline.RoboticsFulfill;
doc = kitGraph.Document.Update(doc);
The error:
PX.Data.PXFieldValueProcessingException
HResult=0x80131500
Message=Error: An error occurred during processing of the field Post Period value 07-2022 GL Error: The financial period cannot be specified because the branch has not been specified in the Branch box.
Source=PX.Data
StackTrace:
at PX.Data.PXCache`1.FillWithValues(TNode item, TNode copy, TNode newitem)
at PX.Data.PXCache`1.Update(Object data, Boolean bypassinterceptor)
at PX.Data.PXCache`1.Update(Object data, Boolean bypassinterceptor)
at PX.Data.PXSelectBase`1.Update(Table item)
at PX.CreateKitAssemblyFromSO.Ext.ProcessKitAssemblyItemsPX.GenerateKitAssembly(KitAssemblyEntry kitGraph, ProcessKitAssemblyItemInfoPX soline) in C:\Apps\Acumatica\AcumaticaUpgrade\App_Data\Projects\IntegraOptics\IntegraOptics\IN\ProcessKitAssemblyItemsPX.cs:line 143
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
PXSetPropertyException: GL Error: The financial period cannot be specified because the branch has not been specified in the Branch box.
I have a field updating handler that allows me to examine the kit and I can see the fields relating to Fin Period are all null, however the code that is throwing the exception is buried Acumatica code.
Can someone help identify what has changed with the upgraded version and what I need to do to resolve this? I have confirmed the logged in user has a default branch set, and I can see that the company branch is selected in the GUI.
Looks like we had a method in the KitAssemblyEntry extension that was attempting to update some info the kit immediately and causing the create kit processing screen to barf. The function needed to be rewritten to change the order of operations around a bit.