1.2.0 • Published 2 years ago
svg-odoo v1.2.0
SVG-ODOO
Libreria para simplificar la conexión con odoo sobre JSONRPC.
USO
import { SvgOdoo } from 'svg-odoo';
const connection = SvgOdoo.getIntance({
username: 'Administrador',
password: 'administrador',
port: 8069,
host: 'http://localhost',
baseUrl: 'jsonrpc',
version: '2.0',
database: 'test'
});
connection.login()
Get all items
console.log(await connection.request({
action: MethodsTypes.GET,
model: 'hr.employee',
columns: ['name', 'job_title', 'type_employee']
}));
Get single item
// Get single Item
console.log(await connection.request({
action: MethodsTypes.GET,
model: 'res.country',
columns: ['name', 'code'],
id: 259
}));
Create new item
// Create New Item
console.log(await connection.request({
action: MethodsTypes.POST,
model: 'res.country',
payload: {
name: 'OTRO PAIS',
code: 'ZZZ'
}
}));
Update single item
// Actualizar Item
console.log(await connection.request({
action: MethodsTypes.PUT,
model: 'res.country',
id: 259,
payload: {
name: 'UN PAIS MAS',
code: 'XX'
}
}));
Delete single item
// Eliminar Item
console.log(await connection.request({
action: MethodsTypes.DELETE,
model: 'res.country',
id: 259
}));
Emit Action