How to use API to connect external tools

Public Channel / Odoo Experience 2015

0 0

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. Let's try documentation

10. Hello Michel

16. Create pretty much anything, even fields

18. Error logging !

23. Multi thread write

3. Languages, Libraries XML/JSON RPC

6. Connect, read, write, call methods Basics

19. CSV, multithread Advanced

27. Some real world examples Interface other softwares

32. Thank You Questions ?

1. How to use API to connect external tools SEINLET Nicolas, TECHNICAL CONSULTANT

26. No track in mail.thread Improve performance without tracking modifications in mail.thread

15. Write pictures o Encode the picture file content in base64 o Write it as a regular field

17. Error logging ? o ir.logging model o Readable on the instance

25. Multi thread write/read o Main thread waiting writing threads o Also usable with read (especially with multiple models)

22. Sliced reading o Avoid the « CPU time limit exceeded. » o Read per ~1k records, depending on read fields (O2M, M2O, M2M)

20. Read using CSV o XML ID instead of ID o List of lists instead of list of dicts o Read linked records (O2M, M2M, M20)

8. On saas ? o Do not use Oauth o Set local password for the user o Create a dedicated user o Give required access rights

13. Create an order o Create order and lines in 1 call o Return the created id o Call methods

21. Write using CSV o Write a list of lists instead of a dict o Faster than calling write multiple times o If a line failed, the whole « load » is rolled back o Write on linked fields

4. "   " XML-RPC is a remote procedure call (RPC) protocol which uses XML to encode its calls and HTTP as a transport mechanism. XML RPC

14. o Transaction around the whole method VS each call o What about an error between the SO creation and the confirmation ? RPC vs Method in a module

11. Hello World Connexion Search Read o Supply user_id o Using domain o Return a dict o M2O as list of id and name o Supply list of fields

31. o Free IceCat o Based on Barcode o Odoo on SaaS o Cool e-commerce in minutes o Cool POS in minutes o Source code : Ex 3 : Pictures from web service

29. Ex 1 : Export pickings List pickings Find order List packs List items Generate XML o Add custom fields for export date o Customize barcode interface for packs o Check weight of all products

9. Read o Using python o Using openerplib o Using jsonrpc Connexion Search Read o Connect to instance o Search for partners called Fletcher o Display name and company name

12. Write Connexion Search partner Search products o Check if all informations exists before create order (Products, partners, ...) o Avoid multiple call for the same object creation (Use magic numbers) o Avoid read when unnecessary o Call methods on objects Create quotation Confirm order

24. Multi thread write o Write ~400 records per thread o Better writing rate o Write on linked fields o Harder to manage errors o Avoid using all Odoo workers → 1 thread = 1 Worker o 1 failing line = the whole thread is rolled back o If many fields, or linked fields, or binary fields, take care of CPU time → lower the number of records o Avoid too many threads on the script running machine → change the place of the semaphore

2. o A carrier needs picking information on a regular basis in a file stored on a local computer o A customer wants to send orders and receive invoices using EDIFACT o An Odoo user wants to set pictures on products (50k+) based on an external product database available on Internet o Import external products catalogue, and update prices on a regular basis o How to do it with Odoo ? o Is it possible to automate ? o Even on SaaS ? Introduction

5. o Libraries exists in many languages o Well documented on the Odoo side o o Sample in many langages in the official documentation o ACL and Record rules are respected o Access to any object o Call every method, except browse o number of high-level APIs in various langages o o o o ... XML RPC

28. o Medium size company o Carrier with on-site software o Must generate text files on disk o Odoo on SaaS Ex 1 : Export pickings Wizard  Fully integrated  Manual trigger  Easy use  Manual save of file  Easy maintenance XML RPC  Fully automatic  Harder maintenance  Delay due to cron  Transparent for user

30. o Small size company o Customers with EDIFACT o EDI platform require local windows software o Odoo on SaaS Ex 2 : EDIFACT link Wizard  Same interface  No direct access to disk  Easy maintenance  Easier « on premise » XML RPC  No matter the location of the server  Harder maintenance  Code readability  Do not break the server in case of error  Transparent for user


  • 7686 Total Views
  • 491 Website Views
  • 7195 Embedded Views


  • 0 Social Shares
  • 0 Dislikes

Share count

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

Embeds 6

  • 2
  • 2
  • 1
  • 2
  • 2
  • 1