Skip to content

[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
mainfrom
bugs/Bug-642238-Main-Factura-Duplicada-error-message-appears

Conversation

@DhavalMore88

@DhavalMore88 DhavalMore88 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 14, 2026
@DhavalMore88 DhavalMore88 marked this pull request as ready for review July 14, 2026 13:26
@DhavalMore88 DhavalMore88 requested a review from a team July 14, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant