Giter Site home page Giter Site logo

odoo-client-api's Introduction

#Odoo Client Library

Very SIMPLE and STUPID Pythonic Odoo Client Library to make-use-of Odoo WebServices. It is designed to wrap all XML RPC Technicality into more object-orientated meaning of programming using class and dedicated Methods.

##Features:

  • Basic-Generic ORM API (create, read, write, unlink ...) CRUD.
  • Generic ORM Research API (search, search_read, search_count, name_search ...).
  • Generic superset Method to avoid implmentation (symmetric code but need to be attentive).
  • Dedicated WORKFLOW Methods to drive business process smoothly.
  • Easy SaaS/HTTPS or Local Instance/Database Connection styles.

--

##Usage:

  • Add api directory odooclient to project.
  • Import from odooclient import client.

##Below are examples of odoo-client-api usage :

##Saas Test

from odooclient import client

odoo = client.OdooClient( host='demo.odoo.com', dbname='firebug', saas=True, debug=True)
odoo.ServerInfo()
odoo.Authenticate('admin', 'admin')

##SaaS Security Test

from odooclient import client

odoo = client.OdooClient( host='demo.odoo.com', dbname='firebug', saas=True, debug=True)
odoo.Authenticate('[email protected]', 'a')
odoo.CheckSecurity('res.users', ['create'])
odoo.CheckSecurity('res.partner')

##Local Test

from odooclient import client

odoo = client.OdooClient(protocol='xmlrpc', host='localhost', dbname='test', port=8069, debug=True)
odoo.ServerInfo()
odoo.Authenticate('admin', 'admin')
odoo.Read('res.partner', [1, 2], fields=['name'])
rid = odoo.Create('res.partner', {'name': "Odoo"})
odoo.SearchCount('res.partner')
odoo.Write('res.partner', [rid], {'name': 'Odoo'})
odoo.Search('res.partner', [('name', 'like', 'Odoo')], order='id desc')
odoo.SearchRead('res.partner', [('name', 'like', 'Odoo')], ['name'])
odoo.GetFields('res.partner')
odoo.Copy('res.partner', record_id,{'name': "jigar"})
odoo.NameCreate('res.partner',"jigar")
allids = [o[0] for o in odoo.NameSearch("res.partner", "jigar")]
odoo.Unlink("res.partner", allids)

##Local Security Test

from odooclient import client

odoo = client.OdooClient(protocol='xmlrpc', host='localhost', dbname='test', port=8069, debug=True)
odoo.Authenticate('demo', 'demo')
odoo.CheckSecurity('res.users', ['create'])
odoo.CheckSecurity('res.partner' )

###Generic method Method

For More Control Over API , Generic Method is also implemented, where you can call any method from API, but you have to care full in passing Params :

Method create with odoo-client-lib API look like :

    odoo.Create('res.partner', {'name': "Odoo"})

But this can be also called using Generic method Methodwhich look like:

   odoo.Method('res.partner', 'create', {'name': "Odoo"})

This sounds more Raw and generic but doesn't make difference in this case as create being generic ORM method, but any method implementation specific to Model can be called using Method, this enable Extended API feature.

###Workflow methods :

Odoo has every powerful workflow engine and the lib facilitate you workflow engine methods like Create workflow for some record, or delete the workflow, validate workflow, trigger workflow signals. Below are example of all available methods that can be used. Suport for worflow is for Odoo/OpenERP v9 or earlier versionoly, from Odoov10 the workflow engone is discontinued.

from odooclient import client

odoo = client.OdooClient(protocol='xmlrpc', host='localhost', dbname='asd', port=8069, debug=True)
odoo.Authenticate('admin', 'admin')
print odoo.UnlinkWorkflow('account.invoice', 58328)
print odoo.CreateWorkflow('account.invoice', 58328)
print odoo.StepWorkflow('account.invoice', 58328)
print odoo.SignalWorkflow('account.invoice', 58328, 'invoice_open')
print odoo.RedirectWorkflow('account.invoice', [(58328,58329)])

Note: This is Still development copy not finalized.

##P.S. :

Feature to be Added are :

  • Report Priting API
  • Tools lib.
  • CSV reader
  • Server Friendly Text Sanitizer(Unicode, UTF-8)
  • A Fork with ODBC Features.

odoo-client-api's People

Contributors

jam-odoo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.