RE: Sales order number and Purchase order number as the same
Hello recently I made a similar development, in which I used the native function, to replicate it in another function and add the relationship of the sales order to the purchase order then add this to supplier movements and accounting movements so that the relationship that is born from a sales order appears.
What I recommend is to enter the Objet designer
This is the native action of the sales order page
action(CreatePurchaseOrder)
{
ApplicationArea = Suite;
Caption = 'Create Purchase Orders';
Image = Document;
Promoted = false;
//The property 'PromotedCategory' can only be set if the property 'Promoted' is set to 'true'
//PromotedCategory = Category8;
//The property 'PromotedIsBig' can only be set if the property 'Promoted' is set to 'true'
//PromotedIsBig = true;
ToolTip = 'Create one or more new purchase orders to buy the items that are required by this sales document, minus any quantity that is already available.';
trigger OnAction()
var
PurchDocFromSalesDoc: Codeunit "Purch. Doc. From Sales Doc.";
begin
PurchDocFromSalesDoc.CreatePurchaseOrder(Rec);
end;
}
the native code unit is : codeunit 1314 "Purch. Doc. From Sales Doc."
In this codeunit you can insert in the header of your order or purchase invoice a relationship that you can choose already established in your sales order
Nice to meet you
Kind regards
Gabriel Prinz