Skip to content

[W1][Report][292][Copy Sales Document] Make LookupSalesDoc protected so extensions can reuse it for custom source document types #30396

Description

@mavohra

Why do you need this change?

We add a custom value to "Sales Document Type From" for an internal document type that behaves exactly like Quote/Order/Invoice/etc. for lookup purposes. LookupDocNo()'s case statement only calls LookupSalesDoc() for the built-in values, so for our custom type nothing runs and the lookup silently does nothing. LookupSalesDoc() reads only the report's own protected globals (FromDocType, FromSalesHeader, SalesHeader, FromDocNo), so if it were accessible we could call it directly instead of reimplementing its filtering and lookup logic in our own code.

Describe the request

Change LookupSalesDoc from local to protected so a report extension can call it directly for custom document types not in the base case statement.

protected procedure LookupSalesDoc()
begin
    OnBeforeLookupSalesDoc(FromSalesHeader, SalesHeader, FromDocType);
    ...
end;

Alternatives evaluated:

  • A new event in LookupDocNo()'s case statement for unhandled document types: would still require us to duplicate LookupSalesDoc()'s entire filter-and-lookup body in our own subscriber, since the event can't hand back a call into the private procedure itself.
  • OnBeforeLookupDocNo (already exists, already used by us to intercept before the case runs): confirms our custom type never reaches LookupSalesDoc(), but doesn't expose it.
    Internal work item: AB#645070

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaext-ready-to-implementReviewed and ready to implement and create PRrequest-for-externalRequest for exposing a function for extension development

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions