Skip to content

[Bug]: codeunit 5510 "Production Journal Mgt" - SetTemplateAndBatchName #8273

@auzhhv

Description

@auzhhv

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

  • I will provide a fix for a bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    FinanceGitHub request for Finance area

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions