Tuesday, July 18, 2023
1 change
Resolved issues and error corrections
The Belgian Partner VAT Listing now calculates which partners must appear before applying any user-defined grouping. This prevents incorrect reported amounts when businesses customize the report, and it should also make the report run more efficiently.
Original PR description
The Partner VAT Listing uses a custom engine, meaning that it is possible for the user to customize its line in order to do the grouping differently, and for example have a group by account on top of…
The Partner VAT Listing uses a custom engine, meaning that it is possible for the user to customize its line in order to do the grouping differently, and for example have a group by account on top of the default group by partner. However, due to legal requirements, this report already "injected" a groupby in the SQL ran for its computation, so that we did not report partners not reaching the "turnover" untaxed value of 250 EUR (or another of the special criteria about credit notes). This completely broke custom grouping, as the turnover got computed on the new groups (so, not only "group by partner_id", but "group by account_id,partner_id", for example). The numbers reported in this case were hence completely wrong. With this commit, we rewrite the queries ran by the report so that the partners meeting the appearance criteria (like the turnover) are computed beforehand and the custom groupby can work as usual. Thanks to that, this refactoring also improves the overall performance of the report in the meantime.