Based on the error messages you've shared, I can see you're encountering a System.NullReferenceException during the AP Invoice deletion process. The error occurs specifically in the MoveNext() operation, suggesting an issue with record traversal during deletion.
Analysis of the Error:The stack trace shows the error is occurring in the following sequence:
Check if the invoice is linked to any project transactions
Verify and release any project-related holds or links before deletion
2.Transaction Dependencies
Ensure all related payment applications are properly released
Verify there are no pending GL transactions
3.Data Integrity Steps:
Release the document if it's not in Balanced status
Clear any payment applications
Check for and handle any tax adjustments
Code:
If you want to add additional validation before deletion, you can implement this code in your APInvoiceEntry extension:
public class APInvoiceEntryExt : PXGraphExtension<APInvoiceEntry> { protected virtual void _(Events.RowDeleting<APInvoice> e) { var invoice = e.Row; if (invoice == null) return;
// Check for related project records var projectTrans = PXSelect<PMTran, Where<PMTran.aPDocType, Equal<Required<APInvoice.docType>>, And<PMTran.aPRefNbr, Equal<Required<APInvoice.refNbr>>>>> .Select(Base, invoice.DocType, invoice.RefNbr);
if (projectTrans.Count > 0) { throw new PXException("Cannot delete invoice with related project transactions"); }
// Add additional validation as needed var applications = PXSelect<APAdjust, Where<APAdjust.adjdDocType, Equal<Required<APInvoice.docType>>, And<APAdjust.adjdRefNbr, Equal<Required<APInvoice.refNbr>>>>> .Select(Base, invoice.DocType, invoice.RefNbr);
if (applications.Count > 0) { throw new PXException("Cannot delete invoice with existing applications"); } } }
Recommended Troubleshooting Steps:
First, try releasing the document if it's not already released
Navigate to the Applications tab and verify no payment applications exist
Check Project module for any related transactions
Use the Process Records action to ensure all related records are in the correct state
This will help us provide more specific guidance for your situation.
I think it's something with canada localization. When i turn it off I am able to delete it. Also one instance works correctly with same code regardless of localization although its on upgraded build from 24.204 to 24.205. Not really sure what exactly is problem, maybe need to escalate to acumatica directly
Thank you for the additional information about the Canada localization. This is a valuable insight that helps narrow down the issue.
If the invoice deletion works when the Canada localization is turned off, this suggests a potential issue in the interaction between the AP Invoice deletion process and the Canadian tax reporting/calculation components.
A few observations that might help others:
The issue appears to be specific to Canada localization
The fact that it works on another instance with the same code (24.204 to 24.205) suggests it might be data or configuration related
The NullReferenceException in the stack trace shows involvement of ProjectAccounting, which might be interacting with localization-specific tax calculations
Recommendations:
Check if there are any Canadian tax details or reporting elements attached to the invoice
Compare the configuration settings between your working and non-working instances
Since this appears to be localization-specific and behaves differently across instances with the same build, it would indeed be best to escalate this to Acumatica Support for further investigation
If others encounter this issue, they should check if:
They are using Canadian localization
The issue resolves when temporarily disabling the localization
The behavior is consistent across different instances of the same build
Could you share your Canadian tax configuration settings? This might help identify specific settings that could be triggering this behavior.
Yes, as the trace indicates, it is in the RowPersisted event handler for CA localization of that screen. It may be possible to decompile the localization and identify where the issue arises from, but it’s probably more prudent to simply submit a support case.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.