Best practices to use the API to connect external tools

Public Channel / Odoo Experience 2016

By Ludovic Laffineur - Technical Consultant, Odoo

Share on Social Networks

Share Link

Use permanent link to share in social media

Share with a friend

Please login to send this presentation by email!

Embed in your website

Select page to start with

7. Create a test scenario

4. Goal Make stress tests using XML RPC We can access to all the data and public methods in Odoo using the XML RPC protocol.

2. XML/JSON RPC HTTP JSON

3. Strengths https://www.odoo.com/documentation/9.0/api_integration.html - Libraries in many languages - ACL and Record Rules respected - Access to any object and public method (no _ ) => Also on SaaS!

8. Create a sale order with 5 lines 1 Confirm the sale order Create an invoice Confirm the invoice 2 3 4

6. Tools openerplib import openerplib connection = openerplib.get_connection(hostname= "localhost" , database= "my_db" , \ login= "my_user" , password= "xxx" ) user_model = connection.get_model( "res.users" ) ids = user_model.search([( "login" , "=" , "admin" )]) user_info = user_model.read(ids[0], [ "name" ]) print user_info[ "name" ]

5. Tools xmlrpclib URL = 'http://localhost:8069' DB = 'testDB' USERNAME = 'admin' PASSWORD = 'admin' common = xmlrpclib.ServerProxy('%s/xmlrpc/2/common' % URL ) uid = common.authenticate( DB , USERNAME , PASSWORD , {}) models = xmlrpclib.ServerProxy('%s/xmlrpc/2/object' % URL )) project = models.execute_kw( DB , uid , PASSWORD , 'project.project', 'search_read', [[['name', '=', 'My Project']]], {'fields': ['name', 'product_id', 'attribute_ids'], 'limit': 1} )

1. XML RPC Best practices to use the API to connect external tools Ludovic LAFFINEUR • Technical consultant EXPERIENCE 2016

9. Thank you. #odooexperience EXPERIENCE 2016 Ludovic LAFFINEUR • Technical consultant lla - odoo lla@odoo.com

Views

  • 13 Total Views
  • 0 Website Views
  • 13 Embeded Views

Actions

  • 0 Social Shares
  • 0 Likes
  • 0 Dislikes
  • 0 Comments

Share count

  • 0 Facebook
  • 0 Twitter
  • 0 LinkedIn
  • 0 Google+

Embeds 1

  • 2 onlinesync.odoo.com