npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

odoo-react

v1.0.2

Published

Odoo React

Readme

react-odoo

React library for Odoo using the axios API and JSON-RPC.

Installation

$ npm i odoo-react

or

$ yarn add odoo-react

Usage

Please refer to the Odoo API documentation if you need help structuring your database queries. I'll try to make a more thorough explanation in the future about how it works.

Creating Odoo connection instance Before executing any kind of query operations, a connection instance must be established either with a username/password or with a previously retrieved session id.

import Odoo from 'odoo-react'
const odoo = new Odoo({
  host: 'YOUR_SERVER_ADDRESS',
  port: 8069, /* Defaults to 80 if not specified */
  database: 'YOUR_DATABASE_NAME',
  username: 'YOUR_USERNAME', /* Optional if using a stored session_id */
  password: 'YOUR_PASSWORD', /* Optional if using a stored session_id */
  session_id: 'YOUR_SESSION_ID', /* Optional if using username/password */
  context : 'Your_Context', /* Optional Like Change Language */
})

authenticate Returns a promise which resolves into an object containing the current users' data, including a session id which can be stored for future connections and session persistence.

odoo.authenticate()
.then(response => { /* ... */ })
.catch(e => { /* ... */ })

read Receives an Odoo database model string and a params object containing the ids you want to read and the fields you want to retrieve from each result. Returns a promise which resolves to an array of results matching the array of ids provided in the parameters.

/* read partner from server */
const  params = {
  ids: [1,2,3,4,5],
  fields: [ 'name' ],
}
odoo.read('res.partner', params, context)
.then(response => { /* ... */ })
.catch(e => { /* ... */ })

search_read Just like the Get method, this one also receives a model string and a params object. With this method the parameters may include a domain array for filtering purposes (with filter statements similar to SQL's WHERE), limit and offset values for pagination and an order property which can be set to specific fields. The array of ids becomes optional. Returns a promised which resolves to an array of results matching the parameters provided.

const  params = {
  ids: [1,2,3,4,5],
  domain: [ [ 'list_price', '>', '50' ], [ 'list_price', '<', '65' ] ],
  fields: [ 'name', 'list_price', 'items' ],
  order:  'list_price DESC',
  limit:  5,
  offset:  0,
}

odoo.search_read('product.product', params, context)
.then(response => { /* ... */ })
.catch(e => { /* ... */ })

Create Receives a model string and a params object with properties corresponding to the fields you want to write in the row.

odoo.create('delivery.order.line', {
  sale_order_id: 123
  delivered:  'false',
}, context)
.then(response => { /* ... */ })
.catch(e => { /* ... */ })

Update Receives a model string, an array of ids related to the rows you want to update in the database and a params object with properties corresponding to the fields that are going to be updated.

If you need to update several rows in the database you can take advantage of the Promises API to generate and populate an array of promises by iterating through each operation and then resolving all of them using Promise.all()

odoo.update('delivery.order.line', [ids], {
  delivered:  'true',
  delivery_note:  'Delivered on time!'
}, context)
.then(response => { /* ... */ })
.catch(e => { /* ... */ })

Delete Receives an Odoo database model string and an ids array corresponding to the rows you want to delete in the database.

odoo.delete('delivery.order.line', [ids], context)
.then(response => { /* ... */ })
.catch(e => { /* ... */ })

RPC Call Generic If you wish to execute a custom RPC call not represented in this library's methods, you can also run a custom call by passing an endpoint string and a params object. This requires understanding how the Odoo Web API works more thoroughly so you can properly structure the functions parameters.

odoo.rpc_call('/web/dataset/call_kw', params)
.then(response => { /* ... */ })
.catch(e => { /* ... */ })

References

License

This project is licensed under the MIT License

Acknowledgements

This project was built upon previous versions. It is a fork of AlexisReverte's Node.js library.