Skip to main content

I want to add non stock consulting item(See below figure) to invoices screen details tab when creating prepare invoice from shipments screen. I tried override shipment screen “CreateInvoice” action as well as fire Row Persisted event and override Persist method in Invoices screen too but unbale to do. I saw when fire Row Persisted event or override Persist method just executing(looping) no end point. Please give me any answer or suggestions. 

 

HI @Lalith 

I’m not sure I am understanding what you are asking, but I was able to add a line item after the shipment was created similar to what you did.

Can you possibly explain more please?


Hi @kbeatty21 

I want to add a line item after Invoice is created. 


Hi @Lalith 

Line Item can be added once an invoice is in balanced status not possible after release.

Thank you


Hi @manikantad18 

Thank you your respond. 

Yes I want to add line item, the invoice is in balanced status but automatically. That’s why I tried to use Row Persisted event in the invoice. The problem is event executing continuously.

 


Hi @Lalith  

Are you talking about Automation schedules releasing the invoice?


@kbeatty21 

My code was below. see it. It is working but this event continuously running. I want to stop that only one line item added to that graph.

protected void ARInvoice_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
    {

      
      var row = (ARInvoice)e.Row;
      if (row == null ) return;

      if (e.TranStatus == PXTranStatus.Completed)
      {         

          InventoryItem inventoryItem = new PXSelect<InventoryItem,           Where<InventoryItem.inventoryCD,
                      Equal<Required<InventoryItem.inventoryCD>>>>(Base).Select("ITEM1");


          ARTran aRTran = new ARTran();  
          aRTran.InventoryID = inventoryItem.InventoryID;         
          aRTran.Qty = 1;         
          aRTran.UnitPrice = 0;              
          Base.Transactions.Insert(aRTran);          
          Base.Actions.PressSave();        
          
      }
 
  }
 

 


My target is like this. 

  1. So, all you know we can create Invoices from the shipment screen by using “Prepare Invoice” action.
  2. When means actually after creating a Invoice from that scenario, Just I want to add a special non-stock item which was created invoice.
  3. There fore firstly I created a object and set that item to created object and save to the Invoice graph. The code is below.

    protected void ARInvoice_RowPersisted(PXCache cache, PXRowPersistedEventArgs e)
        {

          
          var row = (ARInvoice)e.Row;
          if (row == null ) return;

          if (e.TranStatus == PXTranStatus.Completed)
          {         

              InventoryItem inventoryItem = new PXSelect<InventoryItem,           Where<InventoryItem.inventoryCD,
                          Equal<Required<InventoryItem.inventoryCD>>>>(Base).Select("ITEM1");


              ARTran aRTran = new ARTran();  
              aRTran.InventoryID = inventoryItem.InventoryID;         
              aRTran.Qty = 1;         
              aRTran.UnitPrice = 0;              
              Base.Transactions.Insert(aRTran);          
              Base.Actions.PressSave();        
              
          }
        }

  4. To do that process I tried handle Row Persisted or Persist(), but that event and method continuously looping. This Invoices screen not like other screen. Same thing I have done  when create shipment. That was fine.
  5. Can you give a solution to exit from a event which continuously looping or any method which I want to  save my nonstock item ASAP.

    @Naveen Boga  do you know any solution?

 


Hi @Lalith - were you able to find a solution? Thank you!


Reply