【发布时间】:2019-11-07 16:24:13
【问题描述】:
我有这种类型的代码可以从OdooRpc中进行选择:
XmlRpcClient client = new XmlRpcClient();
client.Url = LocalApplication.Url;
client.Path = "common";
// LOGIN BG
XmlRpcRequest requestLogin = new XmlRpcRequest("authenticate");
requestLogin.AddParams(LocalApplication.Db, LocalApplication.User, LocalApplication.Pass, XmlRpcParameter.EmptyStruct());
XmlRpcResponse responseLogin = client.Execute(requestLogin);
// READ
client.Path = "object";
// var x = client.Execute("select * from res_partner");
XmlRpcRequest requestSearch = new XmlRpcRequest("execute_kw");
requestSearch.AddParams(LocalApplication.Db, responseLogin.GetInt(),
LocalApplication.Pass, "res.partner", "search_read",
XmlRpcParameter.AsArray(
XmlRpcParameter.AsArray(
XmlRpcParameter.AsArray("is_agent", "=", "True".ToLower()))),
XmlRpcParameter.AsStruct(
XmlRpcParameter.AsMember("fields",
XmlRpcParameter.AsArray("name", "id", "phone", "email"))));
// SAVE
XmlRpcResponse responseSearch = client.Execute(requestSearch);
var agents = (responseSearch.GetObject() as List<object>);
Taswiq.Bussiness.Person p = new Person(LocalApplication.ConnectionString);
if (agents != null)
{
foreach (var a in agents)
{
Dictionary<string, object> agent = a as Dictionary<string, object>;
p.Name = agent["name"].ToString() == "False" ? "ND" : agent["name"].ToString();
p.Marca = Convert.ToInt32(agent["id"]);
p.Type = 1;
p.Phone = agent["phone"].ToString() == "False" ? "ND" : agent["phone"].ToString();
p.Email = agent["email"].ToString() == "False" ? "ND" : agent["email"].ToString();
MessageStruct result = p.Save();
if (result.HasErrors)
{
return result.Message;
}
}
return "Success";
}
一切正常,但现在我需要从这两个表中进行一些连接,如下所示:
Select *
from product_template as d
inner join product_product as r on r.product_tmpl_id = d.id;
除了 Python 代码,我什么也找不到。
谁能帮我解决这个问题?
【问题讨论】: