Skip to Content
Menu
This question has been flagged

I'm creating new sales quotes programatically through the Odoo API like so:

    final Object orderLineItem = asList((Object[]) models.execute("execute_kw", asList(
        db, uid, password,
        "sale.order.line", "search",
        asList(asList()),
        new HashMap() {{
          put("limit", 10);
        }})
      )).get(0);
    final Integer id = (Integer) models.execute("execute_kw", asList(
        db, uid, password,
        "sale.order", "create",
        asList(new HashMap() {{
          put("currency_id", resCurrency);
          put("date_order", dateTime);
          put("partner_id", resPartnerId);
          put("picking_policy", "");
          put("pricelist_id", productPricelistId);
          put("name", name);
          put("warehouse_id", stockWarehouseId);
          put("partner_invoice_id", resPartnerId);
          put("partner_shipping_id", resPartnerId);
          put("access_token", "");
          put("order_line", asList(
            asList(1, false, new HashMap<String, Object>() {{
              put("product_id", orderLineItem);
            }})));
        }})
      ));


However, I'm unable to list products in the quotation's order_line section. Order_line has a one to many relation, but I'm not sure if thats a relationship to products that can be sold to a customer, or something entirely different.

I know the the sale.order.line resources contains all of my 'order_lines' or products, but I'm not sure how to add these products to a new sales quote.

Any help in Java or a python equivalent would be greatly appreciated.

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 24
642
1
Feb 22
2619
1
Feb 22
4809
0
Nov 21
2748
0
Apr 18
3306