I am currently developing an android application for a client who is insisting to use Odoo for API.I don't have any single idea about it I am not getting it any even after referring this link.They provide a URL, Database name, username, and password.If any one did Odoo with Android before, Can you give any suggestions?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
This is Just an Example did to access contacts/partners from odoo:
There are a lot of ways to connect Android to Odoo. Here they are:
Odoo has a Web Service API which is available for Python, Ruby, PHP and Java. I strongly recommend to take a look.
For my case, I have cloned the aXMLRPC git repository, created a package in my project and adapted the original package name. But recently I have found this on Stack Overflow explaining how to add aXMLRPC to your Android project using Gradle (I didn't give it a try yet).
Odoo had made available three endpoints:
xmlrpc/2/db
to get the list of available databases on your server, it does not require to be authenticated;xmlrpc/2/common
to log in to the server, it does not require to be authenticated;xmlrpc/2/object
, is used to call methods of odoo models via theexecute_kw
RPC function.In this class, the constructor as arguments the server address (it can be
http(s)://your_ip_address:the_port_number
) and thepath ('db', 'common' or 'object')
.The checkServer method returns an object which is actually an array containing the list of available databases.
The login mehtod returns an Integer which is the Id of the authenticated user.
For the Odoo CRUD mehtods (search_read, search_count, search, write, create, unlink) you can take a look to the Odoo Web Service API Java code matching the method you want.
Here is an example of the search_read method. I assume that you've an XMLRPCClient named client.
Where
"res.partner"
Collections.singletonList(Collections.singletonList(Arrays.asList("supplier", "=", true)));
fields, the fields you want to get,
You must cast the result of the method to Object[] which will give you an array containing a list of objects each representing a record.
Here the OdooUtil class
If you have a many2one field you only have access to the id and the name of the related record. You can use the following class to get the id and the name of the many2one record.
Example of usage of Many2One class
For other remaining CRUD methods, you can easily find a way how they work by reading the Odoo Web Service API documentation.
I hope this gives you some insights.
If you are creating your application from stretch and only required Android API for Odoo, here is open-source API https://github.com/oogbox/odoo-mobile-api (Odoo android api)
To use in android, first add the following dependency to your app level
build.gradle
compile 'com.oogbox.api:odoo:1.0.0'
Documentation: https://github.com/oogbox/odoo-mobile-api#getting-started
Thanks