With the introduction of NAV2015 Microsoft has reinvented the totals on subpages like on the “Purchase Invoice”. A feature that we know well from the classic world. I don’t think accounting people would like to press F7 or check the statistics every time they want to check the totals before posting. So this feature must be reintroduced.
To get started I will first explain the behavior of this feature.
When you add, change or delete a line to an invoice for example the system will automatically calculate the invoice totals and present them in the subpage.
Every now and then a blue link button appear saying “Totals or discounts may not be up-to-date. Choose the link to update” when opening an invoice.
First I thought that this behavior was because I have imported this invoice. But after diving into the code my guess was wrong. I found that the system will not give me this blue link button every time.
Microsoft has put in a hardcoded performance tuning by disabling the automatic calculation when there are more than 100 lines in the document. That’s nice to know.
Recently I found a bug in the mechanism where my totals aren’t calculated and the blue link button is missing too. Very strange and not regular found. Otherwise this wouldn’t be a bug from NAV2015 until NAV2016 CU2 either. ?
This situation can be simulated by doing the following steps.
- First I make an invoice with 1 line and another with more than 100 lines.
- Then I opened my first invoice and the totals are calculated correctly.
- After that I navigate to the next invoice by pressing Next in the ribbon or pressing Ctrl+PgDn.
- Now the invoice totals aren’t calculated and the blue link button appears. (A normal behavior)
- Without pressing the link button I press Back in the ribbon or pressed Ctrl+PgUp to the previous invoice.
- Now I have the previous invoice but the totals aren’t calculated and the blue link button is missing too. (Bug!)
I wouldn’t be posting this topic without providing you a fix for this situation.
You need to add one line of code where you clear the variable “PreviousTotalPurchaseHeader” in Codeunit 57 “Document Totals”. How simple can it be? This behavior is also affected on the Sales part so you need to fix it the same way.
The good news is that Microsoft is aware of this bug and will add this fix to the next CU update.