Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.08 KB

README.md

File metadata and controls

58 lines (40 loc) · 1.08 KB

angular4-odoorpc

OdooRPC for angular 4

Installation

npm install --save angular4-odoo-jsonrpc

Functions list

  • login(db, user, pass)
  • logout(force)
  • getDbList() // doesn't work with odoo >= 9.0
  • searchRead(model, domain, fields)
  • call(model, method, args, kwargs)

How to use

Import OdooRPCService into component

import { Component } from '@angular/core';
import { OdooRPCService } from 'angular2-odoo-jsonrpc';

Add provider in app component

@Component({
    ...
    providers: [OdooRPCService]
})

Initialize configuration in constructor of component

export class OdooClientExampleComponent {

    constructor(odooRPC: OdooRPCService){
        this.odooRPC.init({
            odoo_server: "https://odoo-server-example",
            http_auth: "username:password" // optional
        });
        this.odooRPC.login('db_example', 'username', 'password').then(res => {
            console.log('login success');
        }).catch( err => {
            console.error('login failed', err);
        })
    }

    ...

}