OdooRPC for Angular 13 or 14 with rxjs
npm install --save angular-odoo-jsonrpc
login(db, user, pass)
logout(force)
getDbList()
searchRead(model, domain, fields, limit, offset, context)
call(model, method, args, kwargs)
Import OdooRPCService
into service or effect
import { OdooRPCService } from 'angular-odoo-jsonrpc';
Initialize configuration in constructor
of component
export class OdooClientExampleService {
constructor(
private odooRPC: OdooRPCService
){
this.odooRPC.init({
odoo_server: "https://odoo-server-example",
http_auth: "username:password" // optional
});
this.odooRPC.login('db_example', 'username', 'password')
.pipe(
tap(() => console.log('login success')),
catchError(err => console.error('login failed', err))
);
}
...
}