I managed to create a product via the XMLRPC in Odoo 9, however i have hard time to set a price within the pricelist tab.
Did lot of searching for the many2many situation, but still not luck.
public interface IOdooCommon : IXmlRpcProxy
{ [XmlRpcMethod("login")]
int Login(string database, string username, string password); }
public interface IOdooObject : IXmlRpcProxy
{
[XmlRpcMethod("execute")]
int Create(string dbname, int uid, string pwd, string obj, string method, XmlRpcStruct strct);
[XmlRpcMethod("execute")]
XmlRpcStruct[] Read(string dbname, int uid, string pwd, string obj, string method, int[] ids, string[] fields);
[XmlRpcMethod("execute")]
int[] Search(string dbname, int uid, string pwd, string obj, string method, object[] filter);
[XmlRpcMethod("execute")]
bool Unlink(string dbname, int uid, string pwd, string obj, string method, int[] ids);
[XmlRpcMethod("execute")]
bool Write(string dbname, int uid, string pwd, string obj, string method, int[] ids, XmlRpcStruct strct);
}
private void button1_Click(object sender, EventArgs e)
{
string dbname = "database";
string userName = "contact@ttest.ro";
string pwd = "passw";
IOdooCommon odooProxyCommon = XmlRpcProxyGen.Create<IOdooCommon>(); odooProxyCommon.Url = "http://192.168.0.105:8069/xmlrpc/common"; int userId = odooProxyCommon.Login(dbname, userName, pwd);
IOdooObject odooProxyObject = XmlRpcProxyGen.Create<IOdooObject>();
XmlRpcStruct dic = new XmlRpcStruct();
dic.Add("name", textBox1.Text);
XmlRpcStruct pret = new XmlRpcStruct();
pret.Add("pricelist_id", 2);
pret.Add("fixed_price", 100);
dic.Add("item_ids", pret);
int pretX = odooProxyObject.Create(dbname, userId, pwd, "product.product", "create", dic);
}