Skip to Content
  • +31 653-919-302
Cafayate.Net
  • 0
  • 0
  • Sign in
  • Nederlands English (US) Español (AR)
  • Contact Us
  • Home
  • Blog
  • Jobs
  • Contact us
Cafayate.Net
  • 0
  • 0
    • Home
    • Blog
    • Jobs
    • Contact us
  • +31 653-919-302
  • Nederlands English (US) Español (AR)
  • Sign in
  • Contact Us

Odoo angular2-odoorpc

  • All Blogs
  • Tech Blog
  • Odoo angular2-odoorpc
  • March 5, 2021 by
    Administrator

    OdooRPC for angular2

    Migrate from https://github.com/akretion/angular-odoo/blob/master/src/components/odoo/jsonRpc-service.js

    • Support Basic Authentication

    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);
            })
        }
    
        ...
    
    }
    in Tech Blog
    LXC Kali

    Designed for companies

    We are a team of passionate people whose goal is to improve everyone's life through disruptive products. We build great products to solve your business problems. Our products are designed for small to medium size companies willing to optimize their performance.

    Get in touch

    Plantexel
    Pedernera
    Salta Capital 
    Argenina

    • +31 653-919-302
    • [email protected]
    Follow us
    Copyright © Plantexel
    Nederlands | English (US) | Español (AR)