Describe the issue
There is a bug in codeunit 5510 "Production Journal Mgt" in procedure SetTemplateAndBatchName.
ItemJnlTemplate.SetRange("Page ID", PageID);
ItemJnlTemplate.SetRange(Recurring, false);
ItemJnlTemplate.SetRange(Type, PageTemplate);
if not ItemJnlTemplate.FindFirst() then begin
ItemJnlTemplate.Init();
ItemJnlTemplate.Recurring := false;
ItemJnlTemplate.Validate(Type, PageTemplate);
ItemJnlTemplate.Validate("Page ID"); // This should validate PageID
When the record is inserted it is missing page id.
The next time the same procedure is called it will still not find the record (because of the filters), but try to insert the same record it has already inserted.
Expected behavior
If a record with the page id is missing, it should insert a record with the same page id, and not 0.
Steps to reproduce
View the example, it's a straight forward issue.
Additional context
No response
I will provide a fix for a bug
Describe the issue
There is a bug in codeunit 5510 "Production Journal Mgt" in procedure SetTemplateAndBatchName.
When the record is inserted it is missing page id.
The next time the same procedure is called it will still not find the record (because of the filters), but try to insert the same record it has already inserted.
Expected behavior
If a record with the page id is missing, it should insert a record with the same page id, and not 0.
Steps to reproduce
View the example, it's a straight forward issue.
Additional context
No response
I will provide a fix for a bug