Solved

Copy value of field from POLine to POReceiptLine when creating Purchase Receipt

  • 26 November 2022
  • 4 replies
  • 202 views

Userlevel 3
Badge

Hi every one,

I have a custom field on POLine named “Custom Note” (UsrCustomNote)

I want to bring this field to POReceiptLine when creating Purchase Receipt by click button “ENTER TO RECEIPT”

The goal like:

 

Could you please help me?

 

Regards,

Khoi

icon

Best answer by Naveen Boga 26 November 2022, 07:37

View original

4 replies

Userlevel 7
Badge +17

Hi @mrthanhkhoi  Below is the code to bring the Custom Note field from the Purchase Orders Line to Receipt Line.

 

I have verified with the below and it is working fine.

   public class POReceiptLineExt : PXCacheExtension<POReceiptLine>
{
[PXDBString(100,IsUnicode =true)]
[PXDefault(typeof(Search<POLineExt.usrCustomNote,Where<POLine.orderType,Equal<Current<POReceiptLine.pOType>>,
And<POLine.orderNbr,Equal<Current<POReceiptLine.pONbr>>,
And<POLine.lineNbr,Equal<Current<POReceiptLine.pOLineNbr>>>>>>), PersistingCheck = PXPersistingCheck.Nothing)]
public string UsrTestField { get; set; }
public abstract class usrTestField : PX.Data.BQL.BqlString.Field<usrTestField> { }

}

 

 

 

Userlevel 3
Badge

Hi @Naveen Boga,

thank you very much for your question.

In addition, How to update value of this field when we make an update on the field usrCustomNote on POLine? it means: update field usrCustomNote on POLine → sync this value to the field on POReceiptLine

 

Could you please help me on that?

 

Regards,

Khoi

Userlevel 7
Badge +17

@mrthanhkhoi  You follow the below steps.

  1. Extend the POOrderEntry Graph
  2. Override the Persist method to write a logic to update the field in the POReceiptLine
  3. In logic, you can create the POReceiptEntry graph object
  4. Fetch POReceiptLine with the fields POOrderType, POOrderNbr and POLineNbr
  5. assign the value from POLine field to POReceiptLine field
  6. Update the cache
  7. Save the POReceiptEntry graph.

Note: You cannot edit the PO when status is in OPEN and can only edit when PO is in HOLD status.

 

Userlevel 3
Badge

Hi @Naveen Boga  

thank you very much for your help.

 

Have a nice day!

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