Skip to Content
Menu
This question has been flagged
2 Replies
23688 Views

How to connect odoo with flutter app, using odoo_api ?

Avatar
Discard
Author Best Answer


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
Avatar
Discard
Best Answer

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

Avatar
Discard