在Odoo中的Many2Many字段插入请求在android中不起作用

冲天香阵透长安,满城尽带黄金甲。这篇文章主要讲述在Odoo中的Many2Many字段插入请求在android中不起作用相关的知识,希望能为你提供帮助。
我正在尝试与Odoo的与会者建立一个会议,与会者的领域是很多2个领域。如果我不将它添加到请求中,会议就会很好地创建,无需与会者。但是,如果我添加对应于many2many字段的"partner_ids"键。会议没有出现。以下是我尝试过的示例:

// Attempt 1 : add them as an integer array List< Integer> partnerIds= new ArrayList< > (); partnerIds.add(15403); partnerIds.add(7567); partnerIds.add(7564); // Attempt 2 : add them in a hashmap array; List< HashMap< String,Integer> > hashMapList= new ArrayList< > (); HashMap< String,Integer> hashMap= new HashMap< > (); hashMap.put("id",15401); HashMap< String,Integer> hashMap2= new HashMap< > (); hashMap2.put("id",15400); HashMap< String,Integer> hashMap3= new HashMap< > (); hashMap3.put("id",15399); hashMapList.add(hashMap); hashMapList.add(hashMap2); hashMapList.add(hashMap3);

尝试3:将它们添加到对象列表中,如here所述
List< Object> testObj= new ArrayList< > (); //Object obj = new Object(); testObj.add(0); testObj.add(0); testObj.add(hashMapList); List< Object> manyToManyRecord = new ArrayList< > (); manyToManyRecord.add(testObj); Log.d("manyToManyRecord", manyToManyRecord.toString()); OdooValues values = new OdooValues(); values.put("opportunity_id",25619); values.put("partner_ids", manyToManyRecord); values.put("name", "App Discussion Meet "); values.put("start", "2019-03-27 10:00:00"); values.put("stop", "2019-03-27 20:00:00"); values.put("allday", false); values.put("day", 0); values.put("user_id", 1); values.put("active", true); values.put("recurrent_id", 0); values.put("x_project_latitude", 0); values.put("x_project_longitude", 0); values.put("description", "Test Meeting Description"); client.create("calendar.event", values, new IOdooResponse() { @Override public void onResult(OdooResult result) { int serverId = result.getInt("result"); Log.d("Meeting Id", String.valueOf(serverId)); } });

那么我犯的错误在哪里?任何有关步骤的帮助表示赞赏!
答案【在Odoo中的Many2Many字段插入请求在android中不起作用】这个解决方案对我有用:
//The 15401,15400... are static ids that were inputted for testing values.put("partner_ids", asList(asList(6, 0, asList(15401,15400,15399))));


    推荐阅读