Announcements
We are running AX 2012 R3 and we have an issue with project accounting distributions connected to a purchase order line item after following a very specific set of steps:
This eventually leads to our users posting vendor invoices which have project ids on the lines but no project transaction being generated.
What I found in the code is the class AccountingDistributionProcessor has a delegate which notifies the classAccDistProcessorProjectExtension whenever an accounting distribution is updated. The AccDistProcessorProjectExtension gets the source document lines that were updated and processes each of them. In my case, just one source document line is involved. The AccDistProcessorProjectExtension loops over all of the accounting distributions that are linked to the source document line and tries to add a related ProjectAccountingDistribution record if needed. I noticed as it loops through the accounting distributions, it can add a related project accounting distribution for a variety of reasons (if there's a reference accounting distribution, a parent accounting distribution, a reversed accounting distribution, and a few other scenarios. I can see that the first accounting distribution record which never had a project linked is getting one created from a reversed distribution. This is happening in \Classes\AccDistProcessorProjectExtension#createFromReversedDistribution
This code looks into a map for any accounting distribution recids that were reversed and if it finds one for this source document line then it generates the project accounting distribution and links it to the accounting distribution that it's processing. Then it removes that key from the map. Because it's been removed from the map, when we get around to processing the last accounting distribution which should get an associated project accounting distribution, nothing is found in this map for the source document line and so no project accounting distribution is created.
What I found is if I simply apply an order by recid descending as the accounting distribution records are processed in the processRegularDistributions method, then the latest accounting distribution is processed first and gets a project accounting distribution as expected and the original one does not. This fix seems to work but I'm wondering if anyone who is more familiar with the process of updating project accounting distributions would be able to weigh in on anything I may be missing. Does this seem like a bug in Microsoft's project accounting distribution processor? I'm anxious to change this low level code. I look over at LCS finds 100s of issues around project accounting distributions but nothing is coming up on this particular method (\Classes\AccDistProcessorProjectExtension\#processRegularDistributions).
Is anyone familiar with this process? Any suggestion on getting it fixed?
Thank you, I hadn't realized that we have a customization to allow the project id to be edited on purchase order lines. Looks like we've opened a can of worms with that customization.
Hi,
How did you do No 2?
I would expect that this is not possible unless somebody has modified something.
Best regards,
Ludwig
André Arnaud de Cal...
293,323
Super User 2025 Season 1
Martin Dráb
232,191
Most Valuable Professional
nmaenpaa
101,158
Moderator