diff --git a/src/Layers/BE/BaseApp/Finance/VAT/Reporting/VATStatementLine.Table.al b/src/Layers/BE/BaseApp/Finance/VAT/Reporting/VATStatementLine.Table.al index 1591e538451..b86e04530bd 100644 --- a/src/Layers/BE/BaseApp/Finance/VAT/Reporting/VATStatementLine.Table.al +++ b/src/Layers/BE/BaseApp/Finance/VAT/Reporting/VATStatementLine.Table.al @@ -146,7 +146,7 @@ table 256 "VAT Statement Line" trigger OnValidate() begin - if "Amount Type" <> "Amount Type"::Amount then + if not ("Amount Type" in ["Amount Type"::Amount, "Amount Type"::Base]) then "Incl. Non Deductible VAT" := false; end; } diff --git a/src/Layers/BE/Tests/Local/VATReportsBE.Codeunit.al b/src/Layers/BE/Tests/Local/VATReportsBE.Codeunit.al index 8865d545b08..ebfaa26ad03 100644 --- a/src/Layers/BE/Tests/Local/VATReportsBE.Codeunit.al +++ b/src/Layers/BE/Tests/Local/VATReportsBE.Codeunit.al @@ -550,8 +550,9 @@ codeunit 144010 "VAT Reports BE" // [SCENARIO 379117] User should be able to use "Incl. Non Deductible VAT" for VAT Settlement rows with "Amount Type" Base Initialize(); - VATStatementLine."Amount Type" := VATStatementLine."Amount Type"::Base; + VATStatementLine.Validate("Amount Type", VATStatementLine."Amount Type"::Amount); VATStatementLine.Validate("Incl. Non Deductible VAT", true); + VATStatementLine.Validate("Amount Type", VATStatementLine."Amount Type"::Base); VATStatementLine.TestField("Incl. Non Deductible VAT", true); end; @@ -688,6 +689,20 @@ codeunit 144010 "VAT Reports BE" Assert.IsTrue(FILE.Exists(FileName), StrSubstNo('%1 %2', FileName, NotFoundMsg)); end; + [Test] + procedure InclNonDeductibleVATClearedForNotAllowedAmountType() + var + VATStatementLine: Record "VAT Statement Line"; + begin + // [SCENARIO 656742] "Incl. Non Deductible VAT" is cleared when "Amount Type" is changed to an unsupported type + + Initialize(); + VATStatementLine.Validate("Amount Type", VATStatementLine."Amount Type"::Amount); + VATStatementLine.Validate("Incl. Non Deductible VAT", true); + VATStatementLine.Validate("Amount Type", VATStatementLine."Amount Type"::"Unrealized Base"); + VATStatementLine.TestField("Incl. Non Deductible VAT", false); + end; + local procedure Initialize() var VATVIESCorrection: Record "VAT VIES Correction";