public String getDatasFromServer(Integer row_id) { try { ODomain domain = new ODomain(); domain.add("id", "=", selectServerId(row_id)); JSONObject fields = new JSONObject(); fields.accumulate("fields", "datas"); JSONObject result = getServerDataHelper().getOdoo().search_read(getModelName(), fields, domain.get()); if (result.getJSONArray("records").length() > 0) { JSONObject row = result.getJSONArray("records").getJSONObject(0); return row.getString("datas"); } } catch (Exception e) { e.printStackTrace(); } return "false"; }
@Override protected List<ODataRow> doInBackground(String... params) { try { ServerDataHelper helper = mRelModel.getServerDataHelper(); ODomain domain = new ODomain(); domain.add(mRelModel.getDefaultNameColumn(), "ilike", params[0]); if (mCol != null) { for (String key : mCol.getDomains().keySet()) { OColumn.ColumnDomain dom = mCol.getDomains().get(key); domain.add(dom.getColumn(), dom.getOperator(), dom.getValue()); } } OdooFields fields = new OdooFields(mRelModel.getColumns()); return helper.searchRecords(fields, domain, 10); } catch (Exception e) { e.printStackTrace(); } return null; }