@buyerjourney/bj-odoo
v0.5.1
Published
json-rpc connection for odoo
Downloads
5
Readme
bj-odoo
json-rpc connection for odoo
Sponsors
Methods
- odoo.login()
- odoo.count(object, ...args)
- odoo.create(object, ...args)
- odoo.search(object, ...args)
- odoo.searchRead(object, ...args)
- odoo.read(object, ...args)
- odoo.update(object, ...args)
- odoo.delete(object, ...args)
Installation
npm i @buyerjourney/bj-odoo
Configuration
{
"odoo":{
"host":"http://url",
"db":"odooDB",
"port":8069,
"username":"user",
"password":"apiKey",
"endpoint":"/jsonrpc"
}
}
Usage
import { OdooClient } from "@buyerjourney/bj-odoo";
import config from '/.env/conf.json' assert { type: 'json' };
async function createLead(props={}){
try {
let odoo = new OdooClient(config.odoo)
let uid = await odoo.login();
crmLead = {
name:props.subject,
contact_name:props.name,
function: props.function,
partner_name:props.company,
email_from:props.email,
phone:props.phone,
description:props.description
}
let lead = await odoo.create('crm.lead',crmLead);
}catch (error){
console.error('Error:', error);
}
}
Documentation
License
bj-odoo is GPL-3.0-or-later.