您如何搜索知道其 ID 的 Odoo 对象?
How do you search an Odoo Object knowing its id?
Odoo:以下代码 return 是一个 'java.lang.Integer' id 的数组。
asList((Object[])models.execute("execute_kw", asList(
db, uid, password,
"res.partner", "search",
asList(asList(
asList("is_company", "=", true),
asList("customer", "=", true))))));
[7, 18, 12, 14, 17, 19, 8, 31, 26, 16, 13, 20, 30, 22, 29, 15, 23, 28, 74]
哪个反向调用将 return 与每个 id 相关联的每个对象的结构和值?
是读取命令。
final List ids = asList((Object[])models.execute(
"execute_kw", asList(
db, uid, password,
"res.partner", "search",
asList(asList(
asList("is_company", "=", true),
asList("customer", "=", true))))));
final Map record = (Map)((Object[])models.execute(
"execute_kw", asList(
db, uid, password,
"res.partner", "read",
asList(ids)
)
))[0];
完成这些示例:
https://www.odoo.com/documentation/13.0/webservices/odoo.html
Odoo:以下代码 return 是一个 'java.lang.Integer' id 的数组。
asList((Object[])models.execute("execute_kw", asList(
db, uid, password,
"res.partner", "search",
asList(asList(
asList("is_company", "=", true),
asList("customer", "=", true))))));
[7, 18, 12, 14, 17, 19, 8, 31, 26, 16, 13, 20, 30, 22, 29, 15, 23, 28, 74]
哪个反向调用将 return 与每个 id 相关联的每个对象的结构和值?
是读取命令。
final List ids = asList((Object[])models.execute(
"execute_kw", asList(
db, uid, password,
"res.partner", "search",
asList(asList(
asList("is_company", "=", true),
asList("customer", "=", true))))));
final Map record = (Map)((Object[])models.execute(
"execute_kw", asList(
db, uid, password,
"res.partner", "read",
asList(ids)
)
))[0];
完成这些示例:
https://www.odoo.com/documentation/13.0/webservices/odoo.html