Skip to Content
0
Feb 12, 2019 at 01:41 AM

Form a sales order through code

50 Views

Dear Experts

  • The problem is one I encountered when forming a sales order
  • The following code
  • import ABSL;
    import AP.CRM.Global;
    foreach(var ins_this in this)
    {
    var Order=SalesOrder.Create();
    if(Order.IsSet())
    {
    Order.BuyerID.content="test";
    Order.Name.content="test";
    Order.BuyerParty.PartyKey.PartyID.content="C00006";

    if(ins_this.Item.Count()>0)
    {
    foreach(var ins_item in ins_this.Item)
    {
    var Item =Order.Item.Create();
    Item.ItemProduct.ProductKey.ProductID.content = "1003";

    if(Item.ItemScheduleLine.Count()>0)
    {
    foreach(var ins_quan in Item.ItemScheduleLine)
    {
    ins_quan.Quantity.content =15;
    }
    }
    var price = Item.PriceAndTaxCalculationItem.ItemMainPrice.Create();
    Item.PriceAndTaxCalculationItem.ItemMainPrice.Rate.DecimalValue=13;
    }
    }
    }
    }

The Error:

  • If I ignore this error and force save, the sales order can still be formed, and the price can also be generated, and the formed sales order has no error
  • So what's error?
  • Thanks in advance for your help!

Attachments

1.png (4.9 kB)