Skip to Content
0
Dec 07, 2017 at 12:20 AM

When create purchase order from purchase request using script, how can create PriceCalculationItem?

105 Views

Hi experts,
In Bydesign System, the business: create a sales order, the purchase request and purchase order will auto create.
The purchase request is created by system(system configuration), and the purchase order must be created by the program.
And the purchase Order's price copy from sales order's price.

About the program, now I create a purchase Order using CreateFromPurchaseRequest() script, but the purchase Order can't create the PriceCalculationItem.

var po_item = PurchaseOrder.CreateFromPurchaseRequest();

var po_item_price = po_item.PriceCalculationItem.Create();

var po_item_price_Price = po_item_price.ItemMainPrice.Create();
var po_item_price_Surcharge = po_item_price.ItemMainSurcharge.Create();
var po_item_price_Discount = po_item_price.ItemMainDiscount.Create();

the po_item_price and po_item_price_Price return null.
Any idea to create the PriceCalculationItem of the PurchaseOrder?

Thanks in advance.
Best Regards,
Benny Huang