-
Notifications
You must be signed in to change notification settings - Fork 631
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
[E-Document Core] - Allow to recreate unposted purchase documents from an incoming e-document #27973
base: main
Are you sure you want to change the base?
[E-Document Core] - Allow to recreate unposted purchase documents from an incoming e-document #27973
Changes from all commits
3e81f6a
f4c11e2
26753b9
8370437
508be12
59a9663
4648160
1687dcd
5b89c53
60bb62b
a19432d
629fe29
08f04de
d8293d2
0d1cc5f
4008028
5c52ac8
4bb541c
8b9b4cd
705b1a0
4a54f57
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 |
---|---|---|
|
@@ -198,7 +198,37 @@ codeunit 6103 "E-Document Subscription" | |
local procedure OnBeforeOnDeletePurchaseHeader(var PurchaseHeader: Record "Purchase Header"; var IsHandled: Boolean) | ||
begin | ||
if not IsNullGuid(PurchaseHeader."E-Document Link") then | ||
Error(DeleteNotAllowedErr); | ||
if GuiAllowed() then | ||
if not Confirm(this.ConfirmDeleteQst) then | ||
Error(''); | ||
end; | ||
|
||
[EventSubscriber(ObjectType::Table, Database::"Purchase Header", 'OnAfterDeleteEvent', '', false, false)] | ||
local procedure OnAfterDeletePurchaseHeader(var Rec: Record "Purchase Header"; RunTrigger: Boolean) | ||
var | ||
EDocument: Record "E-Document"; | ||
EDocumentService: Record "E-Document Service"; | ||
EDocumentLog: Codeunit "E-Document Log"; | ||
EDocumentProcessing: Codeunit "E-Document Processing"; | ||
EDocServiceStatusDeleted: Enum "E-Document Service Status"; | ||
begin | ||
if IsNullGuid(Rec."E-Document Link") then | ||
exit; | ||
|
||
if not EDocument.GetBySystemId(Rec."E-Document Link") then | ||
exit; | ||
|
||
EDocServiceStatusDeleted := Enum::"E-Document Service Status"::"Imported Document Deleted"; | ||
EDocumentService := EDocumentLog.GetLastServiceFromLog(EDocument); | ||
|
||
Clear(EDocument."Document No."); | ||
Clear(EDocument."Document Record ID"); | ||
if Rec."Document Type" = Rec."Document Type"::Order then | ||
Clear(EDocument."Order No."); | ||
|
||
EDocumentLog.InsertLog(EDocument, EDocumentService, EDocServiceStatusDeleted); | ||
EDocumentProcessing.ModifyServiceStatus(EDocument, EDocumentService, EDocServiceStatusDeleted); | ||
EDocumentProcessing.ModifyEDocumentStatus(EDocument, EDocServiceStatusDeleted); | ||
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. Not handled properly. This new status is not taken into account inside the function. 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. The new status translates to "In Progress" E-Document status so it will be handled in this procedure |
||
end; | ||
|
||
local procedure RunEDocumentCheck(Record: Variant; EDocumentProcPhase: Enum "E-Document Processing Phase") | ||
|
@@ -270,6 +300,7 @@ codeunit 6103 "E-Document Subscription" | |
EDocService: Record "E-Document Service"; | ||
EDocumentLog: Codeunit "E-Document Log"; | ||
EDocLogHelper: Codeunit "E-Document Log Helper"; | ||
EDocumentProcessing: Codeunit "E-Document Processing"; | ||
PostedSourceDocumentHeader: RecordRef; | ||
begin | ||
PostedSourceDocumentHeader.GetTable(PostedRecord); | ||
|
@@ -281,6 +312,7 @@ codeunit 6103 "E-Document Subscription" | |
|
||
EDocService := EDocumentLog.GetLastServiceFromLog(EDocument); | ||
EDocLogHelper.InsertLog(EDocument, EDocService, Enum::"E-Document Service Status"::"Imported Document Created"); | ||
EDocumentProcessing.ModifyServiceStatus(EDocument, EDocService, Enum::"E-Document Service Status"::"Imported Document Created"); | ||
end; | ||
|
||
local procedure CreateEDocumentFromPosedDocument(PostedRecord: Variant) | ||
|
@@ -308,5 +340,5 @@ codeunit 6103 "E-Document Subscription" | |
EDocumentHelper: Codeunit "E-Document Helper"; | ||
EDocumentProcessingPhase: Enum "E-Document Processing Phase"; | ||
WrongAmountErr: Label 'Purchase Document cannot be released as Amount Incl. VAT: %1, is different from E-Document Amount Incl. VAT: %2', Comment = '%1 - Purchase document amount, %2 - E-document amount'; | ||
DeleteNotAllowedErr: Label 'Deletion of Purchase Header linked to E-Document is not allowed.'; | ||
ConfirmDeleteQst: Label 'This purchase document is created from an E-Document. Do you want to proceed with deletion?'; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"settings": { | ||
"al.enableCodeAnalysis": true, | ||
"al.codeAnalyzers": [ | ||
"${CodeCop}", | ||
"${UICop}", | ||
"${AppSourceCop}" | ||
] | ||
}, | ||
"folders": [ | ||
{ | ||
"name": "app", | ||
"path": "app" | ||
}, | ||
{ | ||
"name": "test", | ||
"path": "test" | ||
}, | ||
{ | ||
"name": "demo data", | ||
"path": "demo data" | ||
} | ||
] | ||
} |
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 model is insufficient.
Assumption should be that any document type can be deleted.
In case that document is posted it cannot.
How do you know document is posted? E-Doc state Completed should indicate that.