GithubHelp home page GithubHelp logo

odooly-ruby's Introduction

Odooly-Ruby

Lightweight library for browsing and manipulating Odoo / OpenERP data via the XMLRPC API.

How to use

Initialization can be done either in class context or by instantiating an object. The class context way may be advantageous in a Ruby on Rails appication.

It is possible to us e both ways at the same time.

Odooly.configure(scheme: 'http', host: 'localhost', port: 18069, username: 'thom', password: 'thom', database: 'behave')

or

odooly=Odooly.new(scheme: 'http', host: 'localhost', port: 18069, username: 'thom', password: 'thom', database: 'behave')

Searching. After the initialization searching can be performed as shown in this exemplary irb session

2.6.0 :001 > odooly=Odooly.new(scheme: 'http', host: 'localhost', port: 18069, username: 'thom', password: 'thom', database: 'behave')
 => <Odooly thom@behave>
2.6.0 :002 > customers = odooly['res.partner'].search(['last_name=Simpson'])
 => <Odooly::RecordList 'res.partner,[162, 161, 160, 18, 13, 12, 11]'>
2.6.0 :003 > pp customers.name
["Lisa Simpson",
 "Bart Simpson",
 "Homer Simpson",
 "Abraham Simpson",
 "Lisa Simpson",
 "Bart Simpson",
 "Homer Simpson"]
 => ["Lisa Simpson", "Bart Simpson", "Homer Simpson", "Abraham Simpson", "Lisa Simpson", "Bart Simpson", "Homer Simpson"]
2.6.0 :004 > customers.read(['first_name', 'last_name'])
 => [{"first_name"=>"Lisa", "last_name"=>"Simpson", "id"=>162}, {"first_name"=>"Bart", "last_name"=>"Simpson", "id"=>161}, {"first_name"=>"Homer", "last_name"=>"Simpson", "id"=>160}, {"first_name"=>"Abraham", "last_name"=>"Simpson", "id"=>18}, {"first_name"=>"Lisa", "last_name"=>"Simpson", "id"=>13}, {"first_name"=>"Bart", "last_name"=>"Simpson", "id"=>12}, {"first_name"=>"Homer", "last_name"=>"Simpson", "id"=>11}]

Updating values is done as follows:

2.6.0 :005 > customers = odooly['res.partner'].search(['first_name=Abraham', 'last_name=Simpson'])[0]
 => <Odooly::Record 'res.partner,18'>
2.6.0 :006 > customer = odooly['res.partner'].search(['first_name=Abraham', 'last_name=Simpson'])[0]
 => <Odooly::Record 'res.partner,18'>
2.6.0 :007 > customer.write({'last_name': 'Lincoln'})
 => true
2.6.0 :008 > odooly['res.partner'].browse(18).name
 => "Abraham Lincoln"

odooly-ruby's People

Contributors

rusch avatar jlnwlf avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar

Forkers

reneveyj

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.