Dear Odoo Community Members,
I am trying to create a Sales Order from Java Client. I am sucessful by creating a draft quotation but i do not know how to add products into the quotation.
If anybody have a sample in another languages, please share. It will be helpful.
Here is the code to create the quotation
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
public class WSMain {static String url = "http://173.199.117.15:8069";
static String db = "EverFresh";
static String username ="admin";
static String password = "a";
public static void main(String[] args) throws Exception {final XmlRpcClient authClient = new XmlRpcClient();
final XmlRpcClientConfigImpl authStartConfig = new XmlRpcClientConfigImpl();
authStartConfig.setServerURL(
new URL(String.format("%s/xmlrpc/2/common", url)));
List configList = new ArrayList();
Map paramMap = new HashMap();
configList.add(db);
configList.add(username);
configList.add(password);
configList.add(paramMap);
int uid = (int)authClient.execute(
authStartConfig, "authenticate", configList);final XmlRpcClient objClient = new XmlRpcClient();
final XmlRpcClientConfigImpl objStartConfig = new XmlRpcClientConfigImpl();
objStartConfig.setServerURL(
new URL(String.format("%s/xmlrpc/2/object", url)));
objClient.setConfig(objStartConfig);
List paramList = new ArrayList();
configList.clear();
paramMap.clear();
paramList.clear();
configList.add(db);
configList.add(uid);
configList.add(password);
configList.add("sale.order");
configList.add("create");
paramMap.put("partner_id", 1);
paramList.add(paramMap);
configList.add(paramList);int cid = (int)objClient.execute("execute_kw", configList);
System.out.println("Your Sales Order is : " + cid);
}}