Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
24783 Lượt xem

How to connect odoo with flutter app, using odoo_api ?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất


main() {

var client = OdooClient("demo server");


client.connect().then((version) {
print("Connected $version");
});
var conectd = client.authenticate("username","password","Database");
print ("$conectd coonection object");


}

I had seen the odoo_api. the code above explains the connection . But unfortunately I got the "Instance of 'Future<AuthenticateCallback>'" when I print it. Could you please explain how to read the records from database
Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

HI,

If you haven't seen this link yet, see: Odoo Flutter API


Authentication:

Future<AuthenticateCallback> authenticate(
String username, String password, String database) async {
var url = createPath("/web/session/authenticate");
var params = {
"db": database,
"login": username,
"password": password,
"context": {}
};
final response = await callRequest(url, createPayload(params));
final session = await getSessionInfo();
return new AuthenticateCallback(
!response.hasError(), response, session.getSessionId());
}


callKW method

Future<OdooResponse> callKW(String model, String method, List args,
{dynamic kwargs, Map context}) async {
kwargs = kwargs == null ? {} : kwargs;
context = context == null ? {} : context;
var url = createPath("/web/dataset/call_kw/" + model + "/" + method);
var params = {
"model": model,
"method": method,
"args": args,
"kwargs": kwargs,
"context": context
};
return await callRequest(url, createPayload(params));
}


Also you can check this blog: https://www.cybrosys.com/blog/how-to-integrate-odoo-with-android-using-oogbox-mobile-api


Thanks

Ảnh đại diện
Huỷ bỏ