odoo-xmlrpc-client
v0.1.1
Published
Odoo asynchronous XML-RPC client
Downloads
28
Maintainers
Readme
Odoo XML-RPC Client
This project provides a TypeScript client for interacting with Odoo's XML-RPC API. It allows you to authenticate and execute various methods on Odoo models.
Table of Contents
Installation
To install the package, use your favorite package manager. For example, with npm:
npm i odoo-xmlrpc-client
Usage
Here's an example of how to use the Odoo XML-RPC client:
import { OdooXMLRPC, OdooConfig } from 'odoo-xmlrpc-client';
const config: OdooConfig = {
url: 'https://your-odoo-instance.com',
db: 'your-database',
username: 'your-username',
password: 'your-password',
};
const odoo = new OdooXMLRPC(config);
async function main() {
try {
const uid = await odoo.authenticate();
console.log('Authenticated with UID:', uid);
const result = await odoo.execute_kw(
'res.partner',
'search_read',
[[['is_company', '=', true]]],
{ fields: ['name', 'country_id', 'comment'], limit: 5 },
);
console.log('Result:', result);
} catch (error) {
console.error('Error:', error);
}
}
main();
License
This project is licensed under the MIT License - see the LICENSE file for details.