-
Notifications
You must be signed in to change notification settings - Fork 440
[Master]-Inconsistent Validation of Non-Deductible VAT % for Purchase Lines Sharing the Same VAT Identifier #10521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3714,6 +3714,7 @@ table 39 "Purchase Line" | |
| begin | ||
| NonDeductibleVAT.CheckPrepmtWithNonDeductubleVATInPurchaseLine(Rec); | ||
| NonDeductibleVAT.CheckNonDeductibleVATPctIsAllowed(Rec); | ||
| CheckNonDedVATPctConsistencyForZeroLine(); | ||
| UpdateAmounts(); | ||
| end; | ||
| } | ||
|
|
@@ -4377,6 +4378,7 @@ table 39 "Purchase Line" | |
| InvoiceOrOrderDocTypeErr: Label '%1 must be either %2 or %3.', Comment = '%1 - Document Type; %2, %3 - Purchase Document Type, Invoice or Order'; | ||
| CannotInsertPurchLineWithoutHeaderErr: Label 'You cannot insert a purchase line without a purchase header.'; | ||
| MustSpecifyErr: Label 'You must either specify %1 or %2.', Comment = '%1 = Field Caption; %2 = Field Caption'; | ||
| DifferentNonDedVATRatesSameVATIdentifierErr: Label 'You cannot set different Non-Deductible VAT % for the combinations of business and product groups with the same VAT identifier.\The following combination with the same VAT identifier has different Non-Deductible VAT %: business group %1, product group %2', Comment = '%1 = VAT business posting group code, %2 = VAT product posting group code'; | ||
|
|
||
| protected var | ||
| Currency: Record Currency; | ||
|
|
@@ -10993,6 +10995,26 @@ table 39 "Purchase Line" | |
| FieldError(Quantity, StrSubstNo(CorrectiveCreditMemoQtyIncreaseErr, xPurchaseLine.Quantity)); | ||
| end; | ||
|
|
||
| local procedure CheckNonDedVATPctConsistencyForZeroLine() | ||
| var | ||
| PurchLine: Record "Purchase Line"; | ||
| begin | ||
| if "Non-Deductible VAT %" <> 0 then | ||
| exit; | ||
| if "VAT Identifier" = '' then | ||
| exit; | ||
| if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then | ||
| exit; | ||
|
|
||
| PurchLine.SetRange("Document Type", "Document Type"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckNonDedVATPctConsistencyForZeroLine() only reads "VAT Bus. Posting Group" and "VAT Prod. Posting Group", but its FindFirst() on the wide "Purchase Line" table does not call SetLoadFields(), so each validation loads a full row just to build the error text. Add SetLoadFields("VAT Bus. Posting Group", "VAT Prod. Posting Group") before the read. Knowledge: 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| PurchLine.SetRange("Document No.", "Document No."); | ||
| PurchLine.SetFilter("Line No.", '<>%1', "Line No."); | ||
| PurchLine.SetRange("VAT Identifier", "VAT Identifier"); | ||
| PurchLine.SetFilter("Non-Deductible VAT %", '<>%1', "Non-Deductible VAT %"); | ||
| if PurchLine.FindFirst() then | ||
| Error(DifferentNonDedVATRatesSameVATIdentifierErr, PurchLine."VAT Bus. Posting Group", PurchLine."VAT Prod. Posting Group"); | ||
| end; | ||
|
|
||
| [IntegrationEvent(false, false)] | ||
| local procedure OnAfterInitDefaultDimensionSources(var PurchaseLine: Record "Purchase Line"; var DefaultDimSource: List of [Dictionary of [Integer, Code[20]]]; FieldNo: Integer) | ||
| begin | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3690,6 +3690,7 @@ table 39 "Purchase Line" | |
| begin | ||
| NonDeductibleVAT.CheckPrepmtWithNonDeductubleVATInPurchaseLine(Rec); | ||
| NonDeductibleVAT.CheckNonDeductibleVATPctIsAllowed(Rec); | ||
| CheckNonDedVATPctConsistencyForZeroLine(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a new error path to the shipped OnValidate trigger of field 6200 "Non-Deductible VAT %": existing extensions, integrations, or data-migration code that previously called Validate("Non-Deductible VAT %", 0) successfully can now fail when another line on the same document has the same VAT Identifier with a different percentage. Preserve the released field-trigger behavior or move the stricter consistency check behind a compatible opt-in path; BCQuality has no knowledge-backed rule for trigger-behavior breaks yet, so this functional breaking change can only be emitted as an agent finding. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| UpdateAmounts(); | ||
| end; | ||
| } | ||
|
|
@@ -4296,6 +4297,7 @@ table 39 "Purchase Line" | |
| InvoiceOrOrderDocTypeErr: Label '%1 must be either %2 or %3.', Comment = '%1 - Document Type; %2, %3 - Purchase Document Type, Invoice or Order'; | ||
| CannotInsertPurchLineWithoutHeaderErr: Label 'You cannot insert a purchase line without a purchase header.'; | ||
| MustSpecifyErr: Label 'You must either specify %1 or %2.', Comment = '%1 = Field Caption; %2 = Field Caption'; | ||
| DifferentNonDedVATRatesSameVATIdentifierErr: Label 'You cannot set different Non-Deductible VAT % for the combinations of business and product groups with the same VAT identifier.\The following combination with the same VAT identifier has different Non-Deductible VAT %: business group %1, product group %2', Comment = '%1 = VAT business posting group code, %2 = VAT product posting group code'; | ||
|
|
||
| protected var | ||
| Currency: Record Currency; | ||
|
|
@@ -10411,6 +10413,26 @@ table 39 "Purchase Line" | |
| exit("Matched Inv./Cr. Memo Lines" > 0); | ||
| end; | ||
|
|
||
| local procedure CheckNonDedVATPctConsistencyForZeroLine() | ||
| var | ||
| PurchLine: Record "Purchase Line"; | ||
| begin | ||
| if "Non-Deductible VAT %" <> 0 then | ||
| exit; | ||
| if "VAT Identifier" = '' then | ||
| exit; | ||
| if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then | ||
| exit; | ||
|
|
||
| PurchLine.SetRange("Document Type", "Document Type"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckNonDedVATPctConsistencyForZeroLine() only reads "VAT Bus. Posting Group" and "VAT Prod. Posting Group", but its FindFirst() on the wide "Purchase Line" table does not call SetLoadFields(), so each validation loads a full row just to build the error text. Add SetLoadFields("VAT Bus. Posting Group", "VAT Prod. Posting Group") before the read. Knowledge: 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| PurchLine.SetRange("Document No.", "Document No."); | ||
| PurchLine.SetFilter("Line No.", '<>%1', "Line No."); | ||
| PurchLine.SetRange("VAT Identifier", "VAT Identifier"); | ||
| PurchLine.SetFilter("Non-Deductible VAT %", '<>%1', "Non-Deductible VAT %"); | ||
| if PurchLine.FindFirst() then | ||
| Error(DifferentNonDedVATRatesSameVATIdentifierErr, PurchLine."VAT Bus. Posting Group", PurchLine."VAT Prod. Posting Group"); | ||
| end; | ||
|
|
||
| local procedure CheckCorrectiveCreditMemoQtyIncrease(xPurchaseLine: Record "Purchase Line") | ||
| begin | ||
| if not ("Copied From Posted Doc." and IsCreditDocType()) then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3692,6 +3692,7 @@ table 39 "Purchase Line" | |
| begin | ||
| NonDeductibleVAT.CheckPrepmtWithNonDeductubleVATInPurchaseLine(Rec); | ||
| NonDeductibleVAT.CheckNonDeductibleVATPctIsAllowed(Rec); | ||
| CheckNonDedVATPctConsistencyForZeroLine(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a new error path to the shipped OnValidate trigger of field 6200 "Non-Deductible VAT %": existing extensions, integrations, or data-migration code that previously called Validate("Non-Deductible VAT %", 0) successfully can now fail when another line on the same document has the same VAT Identifier with a different percentage. Preserve the released field-trigger behavior or move the stricter consistency check behind a compatible opt-in path; BCQuality has no knowledge-backed rule for trigger-behavior breaks yet, so this functional breaking change can only be emitted as an agent finding. The same issue exists in these regional copies — apply the equivalent fix in each:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| UpdateAmounts(); | ||
| end; | ||
| } | ||
|
|
@@ -4295,6 +4296,7 @@ table 39 "Purchase Line" | |
| InvoiceOrOrderDocTypeErr: Label '%1 must be either %2 or %3.', Comment = '%1 - Document Type; %2, %3 - Purchase Document Type, Invoice or Order'; | ||
| CannotInsertPurchLineWithoutHeaderErr: Label 'You cannot insert a purchase line without a purchase header.'; | ||
| MustSpecifyErr: Label 'You must either specify %1 or %2.', Comment = '%1 = Field Caption; %2 = Field Caption'; | ||
| DifferentNonDedVATRatesSameVATIdentifierErr: Label 'You cannot set different Non-Deductible VAT % for the combinations of business and product groups with the same VAT identifier.\The following combination with the same VAT identifier has different Non-Deductible VAT %: business group %1, product group %2', Comment = '%1 = VAT business posting group code, %2 = VAT product posting group code'; | ||
|
|
||
| protected var | ||
| Currency: Record Currency; | ||
|
|
@@ -10304,6 +10306,26 @@ table 39 "Purchase Line" | |
| exit("Matched Inv./Cr. Memo Lines" > 0); | ||
| end; | ||
|
|
||
| local procedure CheckNonDedVATPctConsistencyForZeroLine() | ||
| var | ||
| PurchLine: Record "Purchase Line"; | ||
| begin | ||
| if "Non-Deductible VAT %" <> 0 then | ||
| exit; | ||
| if "VAT Identifier" = '' then | ||
| exit; | ||
| if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then | ||
| exit; | ||
|
|
||
| PurchLine.SetRange("Document Type", "Document Type"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckNonDedVATPctConsistencyForZeroLine() only reads "VAT Bus. Posting Group" and "VAT Prod. Posting Group", but its FindFirst() on the wide "Purchase Line" table does not call SetLoadFields(), so each validation loads a full row just to build the error text. Add SetLoadFields("VAT Bus. Posting Group", "VAT Prod. Posting Group") before the read. Knowledge: 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| PurchLine.SetRange("Document No.", "Document No."); | ||
| PurchLine.SetFilter("Line No.", '<>%1', "Line No."); | ||
| PurchLine.SetRange("VAT Identifier", "VAT Identifier"); | ||
| PurchLine.SetFilter("Non-Deductible VAT %", '<>%1', "Non-Deductible VAT %"); | ||
| if PurchLine.FindFirst() then | ||
| Error(DifferentNonDedVATRatesSameVATIdentifierErr, PurchLine."VAT Bus. Posting Group", PurchLine."VAT Prod. Posting Group"); | ||
| end; | ||
|
|
||
| local procedure CheckCorrectiveCreditMemoQtyIncrease(xPurchaseLine: Record "Purchase Line") | ||
| begin | ||
| if not ("Copied From Posted Doc." and IsCreditDocType()) then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3688,6 +3688,7 @@ table 39 "Purchase Line" | |
| begin | ||
| NonDeductibleVAT.CheckPrepmtWithNonDeductubleVATInPurchaseLine(Rec); | ||
| NonDeductibleVAT.CheckNonDeductibleVATPctIsAllowed(Rec); | ||
| CheckNonDedVATPctConsistencyForZeroLine(); | ||
| UpdateAmounts(); | ||
| end; | ||
| } | ||
|
|
@@ -4293,6 +4294,7 @@ table 39 "Purchase Line" | |
| InvoiceOrOrderDocTypeErr: Label '%1 must be either %2 or %3.', Comment = '%1 - Document Type; %2, %3 - Purchase Document Type, Invoice or Order'; | ||
| CannotInsertPurchLineWithoutHeaderErr: Label 'You cannot insert a purchase line without a purchase header.'; | ||
| MustSpecifyErr: Label 'You must either specify %1 or %2.', Comment = '%1 = Field Caption; %2 = Field Caption'; | ||
| DifferentNonDedVATRatesSameVATIdentifierErr: Label 'You cannot set different Non-Deductible VAT % for the combinations of business and product groups with the same VAT identifier.\The following combination with the same VAT identifier has different Non-Deductible VAT %: business group %1, product group %2', Comment = '%1 = VAT business posting group code, %2 = VAT product posting group code'; | ||
|
|
||
| protected var | ||
| Currency: Record Currency; | ||
|
|
@@ -10303,6 +10305,26 @@ table 39 "Purchase Line" | |
| exit("Matched Inv./Cr. Memo Lines" > 0); | ||
| end; | ||
|
|
||
| local procedure CheckNonDedVATPctConsistencyForZeroLine() | ||
| var | ||
| PurchLine: Record "Purchase Line"; | ||
| begin | ||
| if "Non-Deductible VAT %" <> 0 then | ||
| exit; | ||
| if "VAT Identifier" = '' then | ||
| exit; | ||
| if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then | ||
| exit; | ||
|
|
||
| PurchLine.SetRange("Document Type", "Document Type"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckNonDedVATPctConsistencyForZeroLine() only reads "VAT Bus. Posting Group" and "VAT Prod. Posting Group", but its FindFirst() on the wide "Purchase Line" table does not call SetLoadFields(), so each validation loads a full row just to build the error text. Add SetLoadFields("VAT Bus. Posting Group", "VAT Prod. Posting Group") before the read. Knowledge: 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| PurchLine.SetRange("Document No.", "Document No."); | ||
| PurchLine.SetFilter("Line No.", '<>%1', "Line No."); | ||
| PurchLine.SetRange("VAT Identifier", "VAT Identifier"); | ||
| PurchLine.SetFilter("Non-Deductible VAT %", '<>%1', "Non-Deductible VAT %"); | ||
| if PurchLine.FindFirst() then | ||
| Error(DifferentNonDedVATRatesSameVATIdentifierErr, PurchLine."VAT Bus. Posting Group", PurchLine."VAT Prod. Posting Group"); | ||
| end; | ||
|
|
||
| local procedure CheckCorrectiveCreditMemoQtyIncrease(xPurchaseLine: Record "Purchase Line") | ||
| begin | ||
| if not ("Copied From Posted Doc." and IsCreditDocType()) then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3692,6 +3692,7 @@ table 39 "Purchase Line" | |
| begin | ||
| NonDeductibleVAT.CheckPrepmtWithNonDeductubleVATInPurchaseLine(Rec); | ||
| NonDeductibleVAT.CheckNonDeductibleVATPctIsAllowed(Rec); | ||
| CheckNonDedVATPctConsistencyForZeroLine(); | ||
| UpdateAmounts(); | ||
| end; | ||
| } | ||
|
|
@@ -4299,6 +4300,7 @@ table 39 "Purchase Line" | |
| InvoiceOrOrderDocTypeErr: Label '%1 must be either %2 or %3.', Comment = '%1 - Document Type; %2, %3 - Purchase Document Type, Invoice or Order'; | ||
| CannotInsertPurchLineWithoutHeaderErr: Label 'You cannot insert a purchase line without a purchase header.'; | ||
| MustSpecifyErr: Label 'You must either specify %1 or %2.', Comment = '%1 = Field Caption; %2 = Field Caption'; | ||
| DifferentNonDedVATRatesSameVATIdentifierErr: Label 'You cannot set different Non-Deductible VAT % for the combinations of business and product groups with the same VAT identifier.\The following combination with the same VAT identifier has different Non-Deductible VAT %: business group %1, product group %2', Comment = '%1 = VAT business posting group code, %2 = VAT product posting group code'; | ||
|
|
||
| protected var | ||
| Currency: Record Currency; | ||
|
|
@@ -10327,6 +10329,26 @@ table 39 "Purchase Line" | |
| exit("Matched Inv./Cr. Memo Lines" > 0); | ||
| end; | ||
|
|
||
| local procedure CheckNonDedVATPctConsistencyForZeroLine() | ||
| var | ||
| PurchLine: Record "Purchase Line"; | ||
| begin | ||
| if "Non-Deductible VAT %" <> 0 then | ||
| exit; | ||
| if "VAT Identifier" = '' then | ||
| exit; | ||
| if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then | ||
| exit; | ||
|
|
||
| PurchLine.SetRange("Document Type", "Document Type"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckNonDedVATPctConsistencyForZeroLine() only reads "VAT Bus. Posting Group" and "VAT Prod. Posting Group", but its FindFirst() on the wide "Purchase Line" table does not call SetLoadFields(), so each validation loads a full row just to build the error text. Add SetLoadFields("VAT Bus. Posting Group", "VAT Prod. Posting Group") before the read. Knowledge: 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| PurchLine.SetRange("Document No.", "Document No."); | ||
| PurchLine.SetFilter("Line No.", '<>%1', "Line No."); | ||
| PurchLine.SetRange("VAT Identifier", "VAT Identifier"); | ||
| PurchLine.SetFilter("Non-Deductible VAT %", '<>%1', "Non-Deductible VAT %"); | ||
| if PurchLine.FindFirst() then | ||
| Error(DifferentNonDedVATRatesSameVATIdentifierErr, PurchLine."VAT Bus. Posting Group", PurchLine."VAT Prod. Posting Group"); | ||
| end; | ||
|
|
||
| local procedure CheckCorrectiveCreditMemoQtyIncrease(xPurchaseLine: Record "Purchase Line") | ||
| begin | ||
| if not ("Copied From Posted Doc." and IsCreditDocType()) then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3689,6 +3689,7 @@ table 39 "Purchase Line" | |
| begin | ||
| NonDeductibleVAT.CheckPrepmtWithNonDeductubleVATInPurchaseLine(Rec); | ||
| NonDeductibleVAT.CheckNonDeductibleVATPctIsAllowed(Rec); | ||
| CheckNonDedVATPctConsistencyForZeroLine(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a new error path to the shipped OnValidate trigger of field 6200 "Non-Deductible VAT %": existing extensions, integrations, or data-migration code that previously called Validate("Non-Deductible VAT %", 0) successfully can now fail when another line on the same document has the same VAT Identifier with a different percentage. Preserve the released field-trigger behavior or move the stricter consistency check behind a compatible opt-in path; BCQuality has no knowledge-backed rule for trigger-behavior breaks yet, so this functional breaking change can only be emitted as an agent finding. The same issue exists in these regional copies — apply the equivalent fix in each:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| UpdateAmounts(); | ||
| end; | ||
| } | ||
|
|
@@ -4286,6 +4287,7 @@ table 39 "Purchase Line" | |
| InvoiceOrOrderDocTypeErr: Label '%1 must be either %2 or %3.', Comment = '%1 - Document Type; %2, %3 - Purchase Document Type, Invoice or Order'; | ||
| CannotInsertPurchLineWithoutHeaderErr: Label 'You cannot insert a purchase line without a purchase header.'; | ||
| MustSpecifyErr: Label 'You must either specify %1 or %2.', Comment = '%1 = Field Caption; %2 = Field Caption'; | ||
| DifferentNonDedVATRatesSameVATIdentifierErr: Label 'You cannot set different Non-Deductible VAT % for the combinations of business and product groups with the same VAT identifier.\The following combination with the same VAT identifier has different Non-Deductible VAT %: business group %1, product group %2', Comment = '%1 = VAT business posting group code, %2 = VAT product posting group code'; | ||
|
|
||
| protected var | ||
| Currency: Record Currency; | ||
|
|
@@ -10296,6 +10298,26 @@ table 39 "Purchase Line" | |
| exit("Matched Inv./Cr. Memo Lines" > 0); | ||
| end; | ||
|
|
||
| local procedure CheckNonDedVATPctConsistencyForZeroLine() | ||
| var | ||
| PurchLine: Record "Purchase Line"; | ||
| begin | ||
| if "Non-Deductible VAT %" <> 0 then | ||
| exit; | ||
| if "VAT Identifier" = '' then | ||
| exit; | ||
| if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then | ||
| exit; | ||
|
|
||
| PurchLine.SetRange("Document Type", "Document Type"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckNonDedVATPctConsistencyForZeroLine() only reads "VAT Bus. Posting Group" and "VAT Prod. Posting Group", but its FindFirst() on the wide "Purchase Line" table does not call SetLoadFields(), so each validation loads a full row just to build the error text. Add SetLoadFields("VAT Bus. Posting Group", "VAT Prod. Posting Group") before the read. Knowledge: The same issue exists in these regional copies — apply the equivalent fix in each:
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| PurchLine.SetRange("Document No.", "Document No."); | ||
| PurchLine.SetFilter("Line No.", '<>%1', "Line No."); | ||
| PurchLine.SetRange("VAT Identifier", "VAT Identifier"); | ||
| PurchLine.SetFilter("Non-Deductible VAT %", '<>%1', "Non-Deductible VAT %"); | ||
| if PurchLine.FindFirst() then | ||
| Error(DifferentNonDedVATRatesSameVATIdentifierErr, PurchLine."VAT Bus. Posting Group", PurchLine."VAT Prod. Posting Group"); | ||
| end; | ||
|
|
||
| local procedure CheckCorrectiveCreditMemoQtyIncrease(xPurchaseLine: Record "Purchase Line") | ||
| begin | ||
| if not ("Copied From Posted Doc." and IsCreditDocType()) then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3705,6 +3705,7 @@ table 39 "Purchase Line" | |
| begin | ||
| NonDeductibleVAT.CheckPrepmtWithNonDeductubleVATInPurchaseLine(Rec); | ||
| NonDeductibleVAT.CheckNonDeductibleVATPctIsAllowed(Rec); | ||
| CheckNonDedVATPctConsistencyForZeroLine(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a new error path to the shipped OnValidate trigger of field 6200 "Non-Deductible VAT %": existing extensions, integrations, or data-migration code that previously called Validate("Non-Deductible VAT %", 0) successfully can now fail when another line on the same document has the same VAT Identifier with a different percentage. Preserve the released field-trigger behavior or move the stricter consistency check behind a compatible opt-in path; BCQuality has no knowledge-backed rule for trigger-behavior breaks yet, so this functional breaking change can only be emitted as an agent finding. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| UpdateAmounts(); | ||
| end; | ||
| } | ||
|
|
@@ -4318,6 +4319,7 @@ table 39 "Purchase Line" | |
| InvoiceOrOrderDocTypeErr: Label '%1 must be either %2 or %3.', Comment = '%1 - Document Type; %2, %3 - Purchase Document Type, Invoice or Order'; | ||
| CannotInsertPurchLineWithoutHeaderErr: Label 'You cannot insert a purchase line without a purchase header.'; | ||
| MustSpecifyErr: Label 'You must either specify %1 or %2.', Comment = '%1 = Field Caption; %2 = Field Caption'; | ||
| DifferentNonDedVATRatesSameVATIdentifierErr: Label 'You cannot set different Non-Deductible VAT % for the combinations of business and product groups with the same VAT identifier.\The following combination with the same VAT identifier has different Non-Deductible VAT %: business group %1, product group %2', Comment = '%1 = VAT business posting group code, %2 = VAT product posting group code'; | ||
|
|
||
| protected var | ||
| Currency: Record Currency; | ||
|
|
@@ -10347,6 +10349,26 @@ table 39 "Purchase Line" | |
| exit("Matched Inv./Cr. Memo Lines" > 0); | ||
| end; | ||
|
|
||
| local procedure CheckNonDedVATPctConsistencyForZeroLine() | ||
| var | ||
| PurchLine: Record "Purchase Line"; | ||
| begin | ||
| if "Non-Deductible VAT %" <> 0 then | ||
| exit; | ||
| if "VAT Identifier" = '' then | ||
| exit; | ||
| if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then | ||
| exit; | ||
|
|
||
| PurchLine.SetRange("Document Type", "Document Type"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckNonDedVATPctConsistencyForZeroLine() only reads "VAT Bus. Posting Group" and "VAT Prod. Posting Group", but its FindFirst() on the wide "Purchase Line" table does not call SetLoadFields(), so each validation loads a full row just to build the error text. Add SetLoadFields("VAT Bus. Posting Group", "VAT Prod. Posting Group") before the read. Knowledge: 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| PurchLine.SetRange("Document No.", "Document No."); | ||
| PurchLine.SetFilter("Line No.", '<>%1', "Line No."); | ||
| PurchLine.SetRange("VAT Identifier", "VAT Identifier"); | ||
| PurchLine.SetFilter("Non-Deductible VAT %", '<>%1', "Non-Deductible VAT %"); | ||
| if PurchLine.FindFirst() then | ||
| Error(DifferentNonDedVATRatesSameVATIdentifierErr, PurchLine."VAT Bus. Posting Group", PurchLine."VAT Prod. Posting Group"); | ||
| end; | ||
|
|
||
| local procedure CheckCorrectiveCreditMemoQtyIncrease(xPurchaseLine: Record "Purchase Line") | ||
| begin | ||
| if not ("Copied From Posted Doc." and IsCreditDocType()) then | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3743,6 +3743,7 @@ table 39 "Purchase Line" | |
| begin | ||
| NonDeductibleVAT.CheckPrepmtWithNonDeductubleVATInPurchaseLine(Rec); | ||
| NonDeductibleVAT.CheckNonDeductibleVATPctIsAllowed(Rec); | ||
| CheckNonDedVATPctConsistencyForZeroLine(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a new error path to the shipped OnValidate trigger of field 6200 "Non-Deductible VAT %": existing extensions, integrations, or data-migration code that previously called Validate("Non-Deductible VAT %", 0) successfully can now fail when another line on the same document has the same VAT Identifier with a different percentage. Preserve the released field-trigger behavior or move the stricter consistency check behind a compatible opt-in path; BCQuality has no knowledge-backed rule for trigger-behavior breaks yet, so this functional breaking change can only be emitted as an agent finding. 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| UpdateAmounts(); | ||
| end; | ||
| } | ||
|
|
@@ -4544,6 +4545,7 @@ table 39 "Purchase Line" | |
| InvoiceOrOrderDocTypeErr: Label '%1 must be either %2 or %3.', Comment = '%1 - Document Type; %2, %3 - Purchase Document Type, Invoice or Order'; | ||
| CannotInsertPurchLineWithoutHeaderErr: Label 'You cannot insert a purchase line without a purchase header.'; | ||
| MustSpecifyErr: Label 'You must either specify %1 or %2.', Comment = '%1 = Field Caption; %2 = Field Caption'; | ||
| DifferentNonDedVATRatesSameVATIdentifierErr: Label 'You cannot set different Non-Deductible VAT % for the combinations of business and product groups with the same VAT identifier.\The following combination with the same VAT identifier has different Non-Deductible VAT %: business group %1, product group %2', Comment = '%1 = VAT business posting group code, %2 = VAT product posting group code'; | ||
|
|
||
| protected var | ||
| Currency: Record Currency; | ||
|
|
@@ -10582,6 +10584,26 @@ table 39 "Purchase Line" | |
| exit("Matched Inv./Cr. Memo Lines" > 0); | ||
| end; | ||
|
|
||
| local procedure CheckNonDedVATPctConsistencyForZeroLine() | ||
| var | ||
| PurchLine: Record "Purchase Line"; | ||
| begin | ||
| if "Non-Deductible VAT %" <> 0 then | ||
| exit; | ||
| if "VAT Identifier" = '' then | ||
| exit; | ||
| if not NonDeductibleVAT.IsNonDeductibleVATEnabled() then | ||
| exit; | ||
|
|
||
| PurchLine.SetRange("Document Type", "Document Type"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CheckNonDedVATPctConsistencyForZeroLine() only reads "VAT Bus. Posting Group" and "VAT Prod. Posting Group", but its FindFirst() on the wide "Purchase Line" table does not call SetLoadFields(), so each validation loads a full row just to build the error text. Add SetLoadFields("VAT Bus. Posting Group", "VAT Prod. Posting Group") before the read. Knowledge: 👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4 |
||
| PurchLine.SetRange("Document No.", "Document No."); | ||
| PurchLine.SetFilter("Line No.", '<>%1', "Line No."); | ||
| PurchLine.SetRange("VAT Identifier", "VAT Identifier"); | ||
| PurchLine.SetFilter("Non-Deductible VAT %", '<>%1', "Non-Deductible VAT %"); | ||
| if PurchLine.FindFirst() then | ||
| Error(DifferentNonDedVATRatesSameVATIdentifierErr, PurchLine."VAT Bus. Posting Group", PurchLine."VAT Prod. Posting Group"); | ||
| end; | ||
|
|
||
| local procedure CheckCorrectiveCreditMemoQtyIncrease(xPurchaseLine: Record "Purchase Line") | ||
| begin | ||
| if not ("Copied From Posted Doc." and IsCreditDocType()) then | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds a new error path to the shipped OnValidate trigger of field 6200 "Non-Deductible VAT %": existing extensions, integrations, or data-migration code that previously called Validate("Non-Deductible VAT %", 0) successfully can now fail when another line on the same document has the same VAT Identifier with a different percentage. Preserve the released field-trigger behavior or move the stricter consistency check behind a compatible opt-in path; BCQuality has no knowledge-backed rule for trigger-behavior breaks yet, so this functional breaking change can only be emitted as an agent finding.
👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.35.4