Skip to content

[29.x] bug 640925 - Enhance draft and proforma invoice report layouts and upgrade tag definitions - #11246

Open
David Holuša (DavidHolusa) wants to merge 3 commits into
releases/29.xfrom
features/640925-29x-DraftAndProformaInvoiceReports2
Open

[29.x] bug 640925 - Enhance draft and proforma invoice report layouts and upgrade tag definitions#11246
David Holuša (DavidHolusa) wants to merge 3 commits into
releases/29.xfrom
features/640925-29x-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:26
@DavidHolusa
David Holuša (DavidHolusa) requested a review from a team as a code owner September 9, 2026 08:26
@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.1 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 adds CZ RDLC layouts for draft and pro forma invoices, initializes them for new companies, and upgrades existing companies to use them when the current default was still unchanged. It also changes the pro forma invoice VAT recap calculation to use temporary sales lines from the posting codeunit before calculating and updating VAT amounts.

Most of the change is targeted, but the upgrade guard does not fully protect existing layout choices. It only checks the tenant layout selection row, while older or custom selections can still live in Report Layout Selection, so the upgrade can replace a real custom report layout.

Problem-solution fit

Fit: Partial

The change matches the goal of enabling CZ-specific invoice layouts and improving the pro forma VAT recap. The fit is incomplete because the upgrade does not reliably skip companies that already selected a custom layout.

Suggestions

S1 (🔴 High): Preserve custom report layout selections
Check Report Layout Selection before treating an empty tenant layout selection as safe to replace. Existing companies can store a custom layout there, so this upgrade can replace that choice with the CZ RDLC layout and change printed invoices.

Risk assessment and necessity

Risk: The main risk is upgrade data mutation in UpgradeApplicationCZL.Codeunit.al, which writes Report Layout Selection and Tenant Report Layout Selection for two sales reports. If the guard is wrong, existing invoice layout customizations can be lost or bypassed. The VAT recap change affects report output only and does not post entries, but it changes visible tax totals on pro forma invoices.

Necessity: The change is useful and scoped to the Czech localization reports. It is needed to make the CZ layouts the default when no custom default exists, but it must preserve existing customer choices before it is safe to merge.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11246 round=1 by=alexei-dobriansky at=2026-09-09T13:44:02Z lastSha=a251dc78c44e09280a3a447b420df5e9a7d38cf3 reviewKey=80d645e5c7535000241c7ce30f79d51448d3149b6b3c9161a1a43e0de864a35a suggestions=S1@65a4d795

…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

This update adds CZ RDLC layouts for draft and pro forma sales invoices, sets them as defaults for new companies, and upgrades existing companies when the current default is still unchanged. It also recalculates the pro forma VAT recap from temporary sales lines and keeps only item lines, which matches the base report's item-only line dataitem.

The new commit tries to protect custom default layouts before calling the default-setting helper. The protection is still incomplete because it only checks the tenant layout selection name. A custom layout can be stored in the report layout selection row without a tenant layout selection row, and the default-setting helper still changes that row.

Status of previous suggestions
ID Title Status Author response
S1 Preserve custom report layout selections Not addressed The new check still only compares the tenant layout selection with report metadata.
New observations (commits since round 1)

None - the new commit only tries to address S1, and no separate new issue was found.

Risk assessment and necessity

Risk: The upgrade code writes Report Layout Selection and Tenant Report Layout Selection for two sales invoice reports. If the guard is wrong, an existing company can lose its selected custom invoice output after upgrade. The report VAT recap change affects printed totals only; its item-line filtering matches the base pro forma report and does not post entries.

Necessity: The change is needed to make the CZ layouts available and default them safely where no custom choice exists. The scope is reasonable, but preserving existing custom selections is required before merge.


[AI-PR-REVIEW] version=1 promptVersion=4 system=github pr=11246 round=2 by=alexei-dobriansky at=2026-09-09T19:05:26Z lastSha=1dd59e7849e02a23fbeff2e0bae4791f27d0dd9c reviewKey=43cbb2b1cf00fcbb78d7c02c786516d0265bf8f25fbbecdf1bb95cb995e0caf6 suggestions=S1@65a4d795:notaddressed parentRound=1

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