Skip to content

Commit 572c71e

Browse files
Fix: re-read Sales Header from DB after RedistributeInvoiceDiscounts
Replace the IsCompletelyShipped save/restore pattern with Rec.Find() after RedistributeInvoiceDiscounts. This re-reads the entire Sales Header record from the database, ensuring all fields including Completely Shipped reflect the true persisted state regardless of any in-memory side effects from the invoice discount redistribution call chain.
1 parent 7dff085 commit 572c71e

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

Apps/W1/APIV1/app/src/pages/APIV1SalesOrders.Page.al

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,14 +451,11 @@ page 20028 "APIV1 - Sales Orders"
451451
}
452452

453453
trigger OnAfterGetRecord()
454-
var
455-
IsCompletelyShipped: Boolean;
456454
begin
457455
SetCalculatedFields();
458456
if HasWritePermission then begin
459-
IsCompletelyShipped := Rec."Completely Shipped";
460457
GraphMgtSalesOrderBuffer.RedistributeInvoiceDiscounts(Rec);
461-
Rec."Completely Shipped" := IsCompletelyShipped;
458+
Rec.Find();
462459
end;
463460
end;
464461

Apps/W1/APIV2/app/src/pages/APIV2SalesOrders.Page.al

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,14 +613,11 @@ page 30028 "APIV2 - Sales Orders"
613613
}
614614

615615
trigger OnAfterGetRecord()
616-
var
617-
IsCompletelyShipped: Boolean;
618616
begin
619617
SetCalculatedFields();
620618
if HasWritePermission then begin
621-
IsCompletelyShipped := Rec."Completely Shipped";
622619
GraphMgtSalesOrderBuffer.RedistributeInvoiceDiscounts(Rec);
623-
Rec."Completely Shipped" := IsCompletelyShipped;
620+
Rec.Find();
624621
end;
625622
end;
626623

0 commit comments

Comments
 (0)