Solved

Version-21.115.0017


Userlevel 1
Badge

Hi,

I have done Custom in Purchase Order Screen
In POLine level am trying to update Curyunitcost according to InventoryID -(Stock Item screen-Valuation Method-Specific)equal to 0

it is updating but in header order total is updating with the price cost which is defined in stock items screen..

From Where it is getting updating am not knowing..

Please Suggest me with the Proper solution

 

icon

Best answer by Naveen Boga 5 January 2022, 11:25

View original

14 replies

Userlevel 7
Badge +17

@FarhanaM60  Are you seeing this issue without your customizations on the instance?

 

Userlevel 4
Badge

Hi @FarhanaM60 

After updating Curyunitcost in POLine, can you raise FieldUpdated event for Order Total field and check whether this helps to update Order Total properly.

Userlevel 1
Badge

Yes its an issue with Customization

Userlevel 1
Badge

@vivekm - I will check now and let you know

Userlevel 1
Badge

@vivekm -its not working 

 

Userlevel 7
Badge +17

@FarhanaM60 It seems caches are not updating properly with you code. 
Can you please share your source code, we can take a look and let you know if we found anything related to this issue.

Userlevel 1
Badge

@Naveen B 

        protected void POLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs el)
        {
            var row = (POLine)el.Row;
            if (row == null) return;

            POLineExt Ext = row.GetExtension<POLineExt>();
            InventoryItem item = PXSelect<InventoryItem, Where<InventoryItem.inventoryID, Equal<Required<InventoryItem.inventoryID>>>>.Select(Base, row.InventoryID);
            if (item?.ValMethod == INValMethod.Specific)
            {

                row.CuryUnitCost = 0;

                Base.Transactions.Cache.RaiseFieldUpdated<POLine.curyUnitCost>(row, null);
                Base.Transactions.Cache.RaiseFieldUpdated<POLine.curyLineAmt>(row, null);
                Base.Transactions.Cache.RaiseFieldUpdated<POLine.curyExtCost>(row, null);
                Base.Document.Cache.RaiseFieldUpdated<POOrder.curyOrderTotal>(row, null);

                //}
            }
            //}
        }

Userlevel 7
Badge +17

@FarhanaM60  I have not tested below, but hope this works. Can you please verify

 

 public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry>
{
protected virtual void POLine_InventoryID_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
POLine row = e.Row as POLine;
if (row != null)
{
InventoryItem item = InventoryItem.PK.Find(Base, row.InventoryID);
if (item?.ValMethod == INValMethod.Specific)
row.CuryUnitCost = 0m;
}
}
}

 

Userlevel 1
Badge

@Naveen B -Only when inventory id is selected it is making value 0 other wise if we change order qty or anything else it is bringing value from Stock items screen

 

Userlevel 7
Badge +17

Hi @FarhanaM60  Understood. I have verified with below and it is working fine.

Please find the source code below.

 public class POOrderEntry_Extension : PXGraphExtension<POOrderEntry>
{
protected virtual void POLine_RowUpdated(PXCache cache, PXRowUpdatedEventArgs e, PXRowUpdated InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
POLine row = e.Row as POLine;
if (row != null)
{
InventoryItem item = InventoryItem.PK.Find(Base, row.InventoryID);
if (item?.ValMethod == INValMethod.Specific)
row.CuryUnitCost = 0m;
}
}

}

 

Userlevel 1
Badge

@Naveen B -same code i have written but order total is not calculating properly

 

Userlevel 7
Badge +17

Hi @FarhanaM60  Instead of going with RowUpdated event, can you try with below code.

This is working in all scenarios. 

  protected virtual void POLine_CuryUnitCost_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e, PXFieldUpdated InvokeBaseHandler)
{
InvokeBaseHandler?.Invoke(cache, e);
POLine row = e.Row as POLine;
if (row != null)
{
InventoryItem item = InventoryItem.PK.Find(Base, row.InventoryID);
if (item != null && item?.ValMethod == INValMethod.Specific && row.CuryUnitCost > 0m)
{
Base.Transactions.Cache.SetValueExt<POLine.curyUnitCost>(row, 0m);
}
}
}

Hope this helps!!

Userlevel 1
Badge

@Naveen B -

Thanks Its working

Userlevel 7
Badge +17

@FarhanaM60  Great :)  Thanks for the confirmation.

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