Skip to Content
Menu
This question has been flagged
2420 Views

Hello good afternoon.

We are integrating an android app to insert orders in odoo.

From our .NET webservice, we perform the insertion of the order correctly using the following code:


Dim Cabecera As XmlRpcStruct = New XmlRpcStruct From {
{"shop_id", 1},
{"state", "draft"},
{"date_order", Convert.ToDateTime(vCabPed("fecha")},
{"user_id", CInt(vIdVendedor)},
{"payment_term_id", CInt(vCabPed("idFormaPago"))},
{"partner_id", vCabPed("idCliente")},
{"partner_invoice_id", vCabPed("idCliente")},
{"note", vCabPed("observacion")},
{"picking_policy", "direct"},
{"order_policy", "manual"},
{"pricelist_id", CInt(vCabPed("idListaPrecio"))},
{"confirmation_date", Convert.ToDateTime(vCabPed("fecha") },
{"partner_shipping_id", vCabPed("idSucursal")}}

IdCabecera = Odoo.Create("sale.order", Cabecera)
Odoo.Write("sale.order", IdCabecera, Cabecera)

Dim vCmdSQL As New SqlCommand("SELECT * FROM LINES where GUID=XXXXXXXX", mConeccion)
vDetPed = vCmdSQL.ExecuteReader
vCmdSQL = Nothing

While vDetPed.Read
    Dim Linea As XmlRpcStruct = New XmlRpcStruct From {
    {"order_id", IdCabecera},
    {"product_id", CInt(vDetPed("idArticulo"))},
    {"name", vDetPed("descripcion")},
    {"quantity", vDetPed("cantidad")},
    {"price_unit", vDetPed("precio").ToString.Replace(",", ".")},
    {"price_total", vDetPed("precio").ToString.Replace(",", ".")},
    {"type", "make_to_stock"},
    {"product_uom_qty", vDetPed("cantidad")}}

    Dim IdLinea As Integer = Odoo.Create("sale.order.line", Linea)
    Odoo.Write("sale.order.line", IdLinea, Linea)
End While


The problem is that each order takes between 1 and 2 minutes to be inserted.

Are we doing something wrong?

See something wrong in the code?

From now, thank you for you help

Avatar
Discard
Related Posts Replies Views Activity
0
Jan 17
2324
0
Jan 23
566
2
Feb 21
5666
0
Sep 24
3
0
Sep 24
348