Skip to content

Commit 8786d37

Browse files
authored
Correct document for embedded PDF (#29667)
<!-- Thank you for submitting a Pull Request. If you're new to contributing to AlAppExtensions please read our pull request guideline below * https://github.com/microsoft/ALAppExtensions/blob/main/CONTRIBUTING.md --> #### Summary <!-- Provide a general summary of your changes --> This pull request updates how `SalesHeader` is populated in the `Export XRechnung Document` codeunit. Instead of using the `PEPPOLMgt.FindNextSalesInvoiceRec` and `PEPPOLMgt.FindNextSalesCreditMemoRec` methods, it now uses `TransferFields` and explicitly sets the `"Document Type"` field. This change fixes the wrong document selection for both invoices and credit memos. #### Work Item(s) <!-- Add the issue number here after the #. The issue needs to be open and approved. Submitting PRs with no linked issues or unapproved issues is highly discouraged. --> Fixes #29665 [AB#620565](https://dynamicssmb2.visualstudio.com/1fcb79e7-ab07-432a-a3c6-6cf5a88ba4a5/_workitems/edit/620565)
1 parent 382ec50 commit 8786d37

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Apps/DE/EDocumentDE/app/src/XRechnung/ExportXRechnungDocument.Codeunit.al

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,12 +956,14 @@ codeunit 13916 "Export XRechnung Document"
956956
Database::"Sales Invoice Header":
957957
begin
958958
HeaderRecordRef.SetTable(SalesInvoiceHeader);
959-
PEPPOLMgt.FindNextSalesInvoiceRec(SalesInvoiceHeader, SalesHeader, 1);
959+
SalesHeader.TransferFields(SalesInvoiceHeader);
960+
SalesHeader."Document Type" := SalesHeader."Document Type"::Invoice;
960961
end;
961962
Database::"Sales Cr.Memo Header":
962963
begin
963964
HeaderRecordRef.SetTable(SalesCrMemoHeader);
964-
PEPPOLMgt.FindNextSalesCreditMemoRec(SalesCrMemoHeader, SalesHeader, 1);
965+
SalesHeader.TransferFields(SalesCrMemoHeader);
966+
SalesHeader."Document Type" := SalesHeader."Document Type"::"Credit Memo";
965967
end;
966968
end;
967969
PEPPOLMgt.GeneratePDFAttachmentAsAdditionalDocRef(

0 commit comments

Comments
 (0)