mirror of
https://github.com/microsoft/BCQuality.git
synced 2026-10-05 14:46:55 +01:00
These articles capture BC-specific mechanics agents still invert: partial-record JIT on writes, Reset clearing SetLoadFields, HttpClient inside write transactions, and batched number series, plus negative guidance that stops over-eager Query and IsEmpty "fixes". Co-authored-by: Cursor <cursoragent@cursor.com>
20 lines
776 B
AL
20 lines
776 B
AL
codeunit 50100 "Batch NoSeries Insert Good"
|
|
{
|
|
procedure InsertDraftOrders(var Customer: Record Customer)
|
|
var
|
|
SalesHeader: Record "Sales Header";
|
|
SalesSetup: Record "Sales & Receivables Setup";
|
|
NoSeriesBatch: Codeunit "No. Series - Batch";
|
|
begin
|
|
SalesSetup.Get();
|
|
if Customer.FindSet() then
|
|
repeat
|
|
SalesHeader.Init();
|
|
SalesHeader."Document Type" := SalesHeader."Document Type"::Order;
|
|
SalesHeader."No." := NoSeriesBatch.GetNextNo(SalesSetup."Order Nos.", WorkDate());
|
|
SalesHeader."Sell-to Customer No." := Customer."No.";
|
|
SalesHeader.Insert(true);
|
|
until Customer.Next() = 0;
|
|
NoSeriesBatch.SaveState();
|
|
end;
|
|
}
|