-
Notifications
You must be signed in to change notification settings - Fork 685
ZUGFeRD Export with custom reports #29255
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
ZUGFeRD Export with custom reports #29255
Conversation
|
This is a first draft on how it would be possible to allow custom reports for the sales invoice for the ZUGfERD format. A partner would need to add the following the their custom sales invoice/cr. memo report.
|
64f2740 to
a62805c
Compare
|
Cool PR @pri-kise 😄 Pros I see of the approach:
"Coding by convention" observations:
One thing I don't like that much is that it's a bit too flexible, and we are losing a bit control of the extensibility story - anything in the stacktrace is now possible to be modified if there's an event and it will only happen when coming from "Export Zugferd Document" which might make things difficult to troubleshoot if things go wrong. I'm usually a bit more conservative and more explicit about what can be modified. That being said, there's nothing wrong with the flexibility, and the scenario may warrant it. An alternative approach could be keep the manual subscription as it is, but in the events of interest where "Export Zugferd Document" subscribes manually, provide hooks (either via events or interfaces) for implementers. The main question I have is: do we envision that there will be several events called while running ExportSalesDocument that the main implementation "Export ZUGFeRD Document" doesn't subscribe to, but that extenders want to subscribe to? We'll have a closer look with Nikola, Milica and Magnus over the week 😃 |
|
@mynjj, I'll create a DevOps PR for us to check that all tests pass etc. I'll add the suggested reviewers. |
|
Processing this PR. The branch is now locked 🔒 Please don't push updates unless otherwise agreed. |
|
The code will be refactored to the following design: Adding the following to EventSubscriberInstance = Manual;
/// <summary>
/// Use this procedure to check if the current report print is for the ZUGFeRD export
/// </summary>
/// <returns>true when the XML should be embedded</returns>
procedure IsZUGFeRDPrintProcess() Result: Boolean
begin
Result := false;
OnIsZUGFeRDPrintProcess(Result);
end;
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Export ZUGFeRD Document", OnIsZUGFeRDPrintProcess, '', false, false)]
local procedure EnableOnIsZUGFeRDPrintProcess(var Result: Boolean)
begin
Result := true;
end;
[InternalEvent(false)]
local procedure OnIsZUGFeRDPrintProcess(var Result: Boolean)
begin
end;Note: The event Instead of the event in the reportextension / report we would simple call the method |
Apps/DE/EDocumentDE/app/src/ZUGFeRD/PostedSalesCrMemo.ReportExt.al
Outdated
Show resolved
Hide resolved
Apps/DE/EDocumentDE/app/src/ZUGFeRD/ExportZUGFeRDDocument.Codeunit.al
Outdated
Show resolved
Hide resolved
|
Merged the latest changes internally. Giving this another go. |
Summary
Enable ZUGFeRD export for custom reports.
Work Item(s)
Fixes #29254
AB#609600