[Main]-"Factura Duplicada" error message appears under SII History if you use the same Vendor Invoice No. for the same Vendor (VAT Registration No.) in different documents in the Spanish version.#9434
Open
DhavalMore88 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug 642238: [master] [All-e]"Factura Duplicada" error message appears under SII History if you use the same Vendor Invoice No. for the same Vendor (VAT Registration No.) in different documents in the Spanish version.
AB#642238
Issue: In the Spanish version, when a purchase document reuses the same External Document No. (Vendor Invoice No. / Vendor Cr. Memo No.) that was already used on a posted document of the opposite type for the same vendor, no warning is shown. Because SII builds the IDFactura key from vendor VAT Reg. No. + External Document No. + Document Date (ignoring invoice vs. credit-memo type), AEAT later rejects the second document as "Factura Duplicada", and the error only surfaces in SII History after posting.
Cause: The standard ShowExternalDocAlreadyExistNotification on Purchase Header only warns when a posted document of the same document type already exists with that External Document No. It never detects the cross-type case (Invoice vs. Credit Memo), which SII nonetheless treats as the same IDFactura, so the duplicate goes unnoticed at entry time.
Solution: Added SII-gated subscribers in SIIPurchaseSubscribers.Codeunit.al on the OnAfterValidate of "Vendor Invoice No." and "Vendor Cr. Memo No.". When SII is enabled, they look for a posted Vendor Ledger Entry of the opposite document type with the same External Document No., vendor, and date (reusing VendorMgt.SetFilterForExternalDocNo, honoring "Same Ext. Doc. No. in Diff. FY", and skipping "Do Not Send To SII" entries) and raise a non-blocking notification warning of a possible "Factura Duplicada", sharing the standard notification's user toggle.