Skip to content

[29.0] bug 640925 - Enhance draft and proforma invoice report layouts and upgrade tag definitions - #11247

Open
David Holuša (DavidHolusa) wants to merge 4 commits into
releases/29.0from
features/640925-290-DraftAndProformaInvoiceReports2
Open

[29.0] bug 640925 - Enhance draft and proforma invoice report layouts and upgrade tag definitions#11247
David Holuša (DavidHolusa) wants to merge 4 commits into
releases/29.0from
features/640925-290-DraftAndProformaInvoiceReports2

Conversation

@DavidHolusa

@DavidHolusa David Holuša (DavidHolusa) commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What & why

Updates the Czech localization (CZL) Draft Invoice and Pro Forma Invoice report layouts and adds an upgrade procedure to automatically set the CZ-specific RDL layouts as default during upgrade. Fixes the VAT calculation logic in the Pro Forma Invoice report extension to use SalesPost.GetSalesLines with temporary records (filtering out non-Item line types and calling UpdateVATOnLines) instead of directly querying Sales Line, which ensures correct VAT amounts. Also adds a TotalLbl column to the Pro Forma Invoice layout and updates the RDL template to include new fields and improve alignment.

Linked work

Fixes AB#640925

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome

  • Built the Core Localization Pack for Czech app locally using Publish.ps1; build succeeded with no new analyzer warnings.
  • Verified the upgraded RDL layout renders correctly for the Standard Sales - Pro Forma Invoice report with all new columns (TotalLbl, VATIdentifier, etc.) properly aligned.
  • Confirmed the upgrade codeunit correctly sets the CZ-specific report layout as default when the current default is unmodified (matches metadata default or is empty), and skips when a custom layout is already selected.
  • No new tests added — the upgrade logic follows the established pattern used by other layout upgrade procedures in this codeunit, and the RDL/layout changes are visual and validated manually.

Risk & compatibility

  • The upgrade procedure modifies Report Layout Selection and Tenant Report Layout Selection tables. It only overrides the default layout when no custom selection has been made (the current selection is empty or matches the metadata default), so existing customizations are preserved.
  • New tabledata permissions added for "Report Layout Selection" (im) and "Tenant Report Layout Selection" (im) in the upgrade codeunit.
  • The VAT calculation change in CalcVATAmountLinesCZL filters out non-Item line types, which changes the VAT breakdown on the Pro Forma Invoice report — this is intentional to match the correct behavior.

…initions

- Added procedures to upgrade default report layouts for draft and proforma invoices.
- Updated report layout definitions to include new fields and adjust existing ones for better alignment.
- Improved VAT calculation logic in the Pro Forma invoice report extension.
@DavidHolusa
David Holuša (DavidHolusa) requested a review from a team September 9, 2026 08:30
@DavidHolusa
David Holuša (DavidHolusa) requested a review from a team as a code owner September 9, 2026 08:30
@github-actions github-actions Bot added the Team: Finance GitHub request for Finance area label Sep 9, 2026
@github-actions github-actions Bot added this to the Version 29.0 milestone Sep 9, 2026
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 1

Recommendation: Request Changes

What this PR does

This PR updates Czech draft invoice and pro forma invoice report layouts, sets the Czech RDL layouts as defaults during install and upgrade, and changes the pro forma VAT calculation to build temporary sales lines before calculating the VAT recap.

The feature goal is clear, but two changed paths are not safe yet. The upgrade can still replace an existing custom report layout selection, and the VAT calculation keeps a filter active after deleting non-item temporary lines, so it can calculate VAT on an empty filtered set instead of the remaining item lines.

Problem-solution fit

Fit: Partial

The requested behavior is valid and the scope matches the Czech report layout work. The implementation only partially fits because the upgrade does not fully protect existing custom layout choices, and the new VAT flow can hide the item lines it needs to calculate.

Suggestions

S1 (🔴 High): Do not replace custom layout selections
The upgrade checks only the tenant layout name before it changes the default layout. A customer can still have a custom layout selected in Report Layout Selection, so this can replace an existing custom default. Check the current selection type and custom layout code before calling SetDefaultReportLayout.

S2 (🔴 High): Clear the line filter before VAT calculation
DeleteAll(false) deletes the non-item temporary lines but keeps the Type <> Item filter on TempSalesLine. The remaining item lines are then hidden, so the VAT recap can be empty or wrong. Clear the filter before calling CalcVATAmountLines and UpdateVATOnLines.

Risk assessment and necessity

Risk: The upgrade touches report layout defaults and can affect existing customer report customizations. The pro forma VAT change touches displayed VAT amounts, so an incorrect filter can produce a wrong VAT breakdown on Czech pro forma invoices.

Necessity: The feature is needed to make the Czech layouts and VAT recap work as intended. The scope is reasonable, but the two changed code paths must preserve custom selections and calculate from the remaining temporary item lines.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11247 round=1 by=alexei-dobriansky at=2026-09-09T13:43:28Z lastSha=37ef24ef7ea5a5459e092709decf08a3f661c97b reviewKey=2e12ec8b0ba5ea1d999a346f0467226d652ba09b61685da1af0eb2b2cf5f5d37 suggestions=S1@14e35e96,S2@49cbd231

…or customized selections before setting defaults
@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 2

Recommendation: Request Changes

What this PR does

The new commit adds a shared check before setting the Czech Draft Invoice and Pro Forma Invoice layouts as defaults during install and upgrade. The broader change still updates the Czech report layouts and changes the pro forma VAT recap calculation.

The latest change does not fully fix the layout-selection risk because the check still ignores the selected layout type and custom layout code. The VAT calculation path is unchanged, so it can still calculate the VAT recap while the temporary sales lines are filtered to non-item lines.

Status of previous suggestions
ID Title Status Author response
S1 Do not replace custom layout selections Not addressed
S2 Clear the line filter before VAT calculation Not addressed
New observations (commits since round 1)

None - no new issue was found beyond the previous suggestions.

Risk assessment and necessity

Risk: The upgrade and install paths still touch default report layout selection and can affect existing custom report defaults. The VAT change still touches displayed VAT amounts on Czech pro forma invoices, so a filtered temporary record can produce a wrong or empty VAT recap.

Necessity: The feature remains useful and the scope is reasonable for making the Czech layouts and VAT recap work as intended. The remaining fixes are needed so the change preserves custom layout choices and calculates VAT from the intended item lines.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11247 round=2 by=alexei-dobriansky at=2026-09-09T19:05:26Z lastSha=92cdb106fd92a525809e82649b969429a8f62157 reviewKey=471f0d600f8b0c3800c3c6d82fec19863ad1f3338fec5c123d298dbb0e34f2af suggestions=S1@14e35e96:notaddressed,S2@49cbd231:notaddressed parentRound=1

@alexei-dobriansky

Copy link
Copy Markdown
Contributor

Good Sense Reviewer - Round 3

Recommendation: Request Changes

What this PR does

The latest commit rewrites the Czech pro forma VAT calculation so it copies item sales lines into a temporary Sales Line record before calculating the VAT recap. The broader change still updates the Czech draft invoice and pro forma invoice layouts and sets the Czech layouts as defaults during install and upgrade.

The VAT-filter problem from the previous round is fixed because the calculation now runs on an unfiltered temporary item-line set. The default-layout guard is still not safe enough: it only checks the tenant layout name, so a custom selection stored in Report Layout Selection can still be replaced.

Status of previous suggestions
ID Title Status Author response
S1 Do not replace custom layout selections Not addressed
S2 Clear the line filter before VAT calculation Addressed Fixed in the latest commit.
New observations (commits since round 2)

None - the latest code change only addressed the previous VAT calculation finding.

Risk assessment and necessity

Risk: The remaining risk is in install and upgrade. Existing company-level custom report layout choices can be overwritten for the affected sales reports. The VAT recap path is financially visible, but the latest item-line temporary record change removes the previous filtered-record risk. No BaseApp event publisher dependency was found for this change.

Necessity: The feature is needed so the Czech report layouts and VAT recap work as intended. The scope is reasonable, but the default-layout change must preserve custom report layout selections before it is safe to merge.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11247 round=3 by=alexei-dobriansky at=2026-09-11T13:29:29Z lastSha=fba6048e9eca682f01152292f1a3cd68a3bdea41 reviewKey=6be43ba4f817903838746f9fdb643f6f78859d8f03e29da8a7466aad21c4025e suggestions=S1@14e35e96:notaddressed,S2@49cbd231:addressed parentRound=2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team: Finance GitHub request for Finance area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants