Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Project accounting distribution connected to the wrong accounting distribution for project purchase order

Posted on by

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: 

  1. Create a purchase order line item with an item id and line amount but no project id and approve and confirm the purchase order
    1. At this point everything is as expected.  There is one accounting distribution record linked to the line and no project accounting distribution
  2. Request change on purchase order and add a project id to the purchase order line item, at this time the line item amount is blanked.  User approves and confirms the purchase order again
    1. At this point everything is still as expected.  There are three accounting distribution records.  The original, a reversal of the original, and a new one which has a linked project accounting distribution
  3. Request change on the purchase order again and add the line amount back to the line item
    1. At this point, the accounting distribution records look correct but something went wrong with the project accounting distribution process because project accounting distributions are getting created for all of the accounting distributions except for the last one.  Somehow project accounting distributions are being created for the original accounting distribution and it's reversal but are not being created for the last accounting distribution which is the one that should have an accounting distribution.

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?  

  • Greg's Mom Profile Picture
    Greg's Mom on at
    RE: Project accounting distribution connected to the wrong accounting distribution for project purchase order

    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.

  • Verified answer
    Ludwig Reinhard Profile Picture
    Ludwig Reinhard Microsoft Employee on at
    RE: Project accounting distribution connected to the wrong accounting distribution for project purchase order

    Hi,

    How did you do No 2?

    I would expect that this is not possible unless somebody has modified something.

    Best regards,

    Ludwig

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans