Question

21R1 - Base.prepareInvoice.Press() results in errors for BigCommerce Order import

  • 15 September 2022
  • 1 reply
  • 40 views

Userlevel 4
Badge

Hi Team,

We have a requirement where we have to import BigCommerce orders with Invoice order template and have to Prepare & Release Invoice subsequently for this order.

We are able to import orders with Invoice order template. Now, when we are trying to execute Prepare Invoice action using Base.prepareInvoice.Press(); we are getting errors like: The Prepare Invoice action is not available in the Sales Order: Order Type = IN; Order Nbr. = AR010201 document at the moment. The document is being used by another process. or simply Invoice.

 

Please find below code piece for review that have tried:

Approach 1: Results in error - The Prepare Invoice action is not available in the Sales Order: Order Type = IN; Order Nbr. = AR010201 document at the moment. The document is being used by another process.

public delegate void PersistDelegate();
        [PXOverride]
        public void Persist(PersistDelegate basemethod)
        {
            basemethod();

            if (Base.Document.Current.xyz == "") //Condition to prevent multiple execution of below prepare invoice action
                Base.prepareInvoice.Press();

        }

 

Approach 2: Results in error - Invoice.

protected virtual void SOOrder_RowPersisted(PXCache sender, PXRowPersistedEventArgs e, PXRowPersisted baseEvent)
        {
            baseEvent(sender, e);

            SOOrder row = e.Row as SOOrder;
            if (row == null) return;

            if (e.TranStatus == PXTranStatus.Completed && Base.Document.Current.xyz == "") //Condition to prevent multiple execution of below prepare invoice action
                Base.prepareInvoice.Press();
        }

 

Can someone suggest the best possible approach to achieve this please.

Thank you in advance!


1 reply

Userlevel 4
Badge

Did you resolve this?

I'm trying to prepare invoice from SOOrderEntry but I got the Invoice error.

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