插入新记录(Odoo) - Odoo移动端框架
Insert new record(Odoo) - Odoo mobile framework
我有一个接受 OValue 的方法:
getResults(OValues values)
方法里面是ff。
ORecordValues value = new ORecordValues();
value.put("order_partner_id", orderline.getPartner(values));
value.put("product_id", orderline.getProduct(values));
value.put("product_uom_qty",values.getInt("product_uom_qty"));
value.put("price_unit", values.getInt("product_uom_qty"));
value.put("discount",values.getInt("product_uom_qty"));
orderline.getServerDataHelper().createOnServer(value);
是否可以直接插入到 Odoo 的服务器而不将其保存到 android 的数据库?
或任何其他方式成功地将数据插入 Odoo 服务器?
在ServerDataHelper中javaclass:
public int createOnServer(ORecordValues data) {
OdooResult result = mOdoo.createRecord(mModel.getModelName(), data);
return result.getInt("result");
}
在服务器上创建记录时需要传递服务器记录ID。
将本地行id(存储在_id
列)传递给selectServerId方法获取服务器id(存储在id
列):
检查以下示例:
ResPartner resPartner = new ResPartner(getApplicationContext(), null);
ProductProduct productProduct = new ProductProduct(getApplicationContext(), null);
...
ORecordValues value = new ORecordValues();
int partner_id = resPartner.selectServerId(values.getInt("partner_id"));
int product_id = productProduct.selectServerId(values.getInt("product_id"));
value.put("order_partner_id", partner_id);
value.put("product_id", product_id);
value.put("product_uom_qty",values.getInt("product_uom_qty"));
value.put("price_unit", values.getInt("product_uom_qty"));
value.put("discount",values.getInt("product_uom_qty"));
orderline.getServerDataHelper().createOnServer(value);
我有一个接受 OValue 的方法:
getResults(OValues values)
方法里面是ff。
ORecordValues value = new ORecordValues();
value.put("order_partner_id", orderline.getPartner(values));
value.put("product_id", orderline.getProduct(values));
value.put("product_uom_qty",values.getInt("product_uom_qty"));
value.put("price_unit", values.getInt("product_uom_qty"));
value.put("discount",values.getInt("product_uom_qty"));
orderline.getServerDataHelper().createOnServer(value);
是否可以直接插入到 Odoo 的服务器而不将其保存到 android 的数据库? 或任何其他方式成功地将数据插入 Odoo 服务器?
在ServerDataHelper中javaclass:
public int createOnServer(ORecordValues data) {
OdooResult result = mOdoo.createRecord(mModel.getModelName(), data);
return result.getInt("result");
}
在服务器上创建记录时需要传递服务器记录ID。
将本地行id(存储在_id
列)传递给selectServerId方法获取服务器id(存储在id
列):
检查以下示例:
ResPartner resPartner = new ResPartner(getApplicationContext(), null);
ProductProduct productProduct = new ProductProduct(getApplicationContext(), null);
...
ORecordValues value = new ORecordValues();
int partner_id = resPartner.selectServerId(values.getInt("partner_id"));
int product_id = productProduct.selectServerId(values.getInt("product_id"));
value.put("order_partner_id", partner_id);
value.put("product_id", product_id);
value.put("product_uom_qty",values.getInt("product_uom_qty"));
value.put("price_unit", values.getInt("product_uom_qty"));
value.put("discount",values.getInt("product_uom_qty"));
orderline.getServerDataHelper().createOnServer(value);