diff --git a/src/Apps/W1/ExpenseAgent/test/src/ExpensePostingVATTest.Codeunit.al b/src/Apps/W1/ExpenseAgent/test/src/ExpensePostingVATTest.Codeunit.al index e481493261c..4f28fd7ca42 100644 --- a/src/Apps/W1/ExpenseAgent/test/src/ExpensePostingVATTest.Codeunit.al +++ b/src/Apps/W1/ExpenseAgent/test/src/ExpensePostingVATTest.Codeunit.al @@ -427,6 +427,7 @@ codeunit 148330 "Expense Posting VAT Test" VATSetup.Modify(true); LibraryERMCountryData.UpdateJournalTemplMandatory(false); + LibraryERMCountryData.UpdateLocalData(); LibraryExpense.SetupNumberSeriesInExpenseMgmt(); LibraryExpense.InitializeExpenseSourceCode(); LibraryExpense.UpdateEnableApprovalWorkflowInAgentSetup(false); diff --git a/src/DisabledTests/Expense_Agent_Tests/Expense_Agent_Tests.DisabledTest.json b/src/DisabledTests/Expense_Agent_Tests/Expense_Agent_Tests.DisabledTest.json index f1181ff4635..380b2231c07 100644 --- a/src/DisabledTests/Expense_Agent_Tests/Expense_Agent_Tests.DisabledTest.json +++ b/src/DisabledTests/Expense_Agent_Tests/Expense_Agent_Tests.DisabledTest.json @@ -183,30 +183,5 @@ "codeunitId": 148319, "codeunitName": "Cancel Posted Exp. Report Test", "method": "CancelMultiLineReportGeneratesNewTransactionNoForReversedLines" - }, - { - "codeunitId": 148330, - "codeunitName": "Expense Posting VAT Test", - "method": "HotelMultiSubcatDiffVAT" - }, - { - "codeunitId": 148330, - "codeunitName": "Expense Posting VAT Test", - "method": "VATEntriesPerHotelSubcat" - }, - { - "codeunitId": 148330, - "codeunitName": "Expense Posting VAT Test", - "method": "GLEntriesCorrectVATAmounts" - }, - { - "codeunitId": 148330, - "codeunitName": "Expense Posting VAT Test", - "method": "HotelRefundableSubcat" - }, - { - "codeunitId": 148330, - "codeunitName": "Expense Posting VAT Test", - "method": "VATSpecApprovedAndRejectedLines" } ] diff --git a/src/Layers/IT/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al b/src/Layers/IT/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al index f06c843ed68..3e852e22af1 100644 --- a/src/Layers/IT/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al +++ b/src/Layers/IT/BaseApp/Finance/GeneralLedger/Posting/GenJnlPostLine.Codeunit.al @@ -879,6 +879,13 @@ codeunit 12 "Gen. Jnl.-Post Line" else VATEntry."VAT Registration No." := GenJnlLine."VAT Registration No."; VATEntry."Country/Region Code" := GenJnlLine."Country/Region Code"; + // When the journal line is created programmatically without going through + // OnValidate of "VAT Prod. Posting Group" (e.g. expense report posting), + // "Deductible %" stays at its default 0. In that case fall back to the + // VAT Posting Setup value so that ChangeVATAmounts uses the correct + // deductible percentage instead of treating all VAT as non-deductible. + if GenJnlLine."Deductible %" = 0 then + GenJnlLine."Deductible %" := VATPostingSetup."Deductible %"; VATEntry."Deductible %" := GenJnlLine."Deductible %"; VATEntry."VAT %" := VATPostingSetup."VAT %"; VATEntry."Operation Occurred Date" := GenJnlLine."Operation Occurred Date";