Ir al contenido
Menú
Se marcó esta pregunta
4323 Vistas

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);
}



Avatar
Descartar
Publicaciones relacionadas Respuestas Vistas Actividad
1
may 15
4027
0
sept 23
1590
1
oct 22
4150
1
mar 22
5016
1
mar 21
5812