JSPM

nestjs-odoo

1.0.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 5
    • Score
      100M100P100Q14717F
    • License MIT

    NestJS integration for Odoo using XML-RPC

    Package Exports

    • nestjs-odoo
    • nestjs-odoo/dist/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nestjs-odoo) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    NestJS Odoo Integration

    A NestJS module for integrating with Odoo using XML-RPC.

    Installation

    npm install nestjs-odoo

    Usage

    // app.module.ts
    import { Module } from '@nestjs/common';
    import { OdooModule } from 'nestjs-odoo';
    
    @Module({
      imports: [
        OdooModule.forRoot({
          url: 'your-odoo-server.com',
          port: 8069,
          db: 'your-database',
          username: 'your-username',
          password: 'your-password',
        }),
      ],
    })
    export class AppModule {}
    
    // your.service.ts
    import { Injectable } from '@nestjs/common';
    import { OdooService } from 'nestjs-odoo';
    
    @Injectable()
    export class YourService {
      constructor(private readonly odooService: OdooService) {}
    
      async getPartners() {
        const partners = await this.odooService.searchRead(
          'res.partner',
          [['is_company', '=', true]],
          ['name', 'email', 'phone'],
        );
        return partners;
      }
    }

    Available Methods

    • authenticate(): Authenticate with Odoo server
    • search(): Search for records
    • read(): Read record details
    • searchRead(): Combine search and read operations
    • create(): Create new records
    • write(): Update existing records
    • unlink(): Delete records

    Configuration

    Basic Configuration

    Use forRoot() to provide static configuration:

    OdooModule.forRoot({
      url: 'your-odoo-server.com',
      port: 8069,
      db: 'your-database',
      username: 'your-username',
      password: 'your-password',
    });

    Async Configuration

    Use forRootAsync() for dynamic configuration:

    OdooModule.forRootAsync({
      inject: [ConfigService],
      useFactory: (configService: ConfigService) => ({
        url: configService.get('ODOO_URL'),
        port: configService.get('ODOO_PORT'),
        db: configService.get('ODOO_DB'),
        username: configService.get('ODOO_USERNAME'),
        password: configService.get('ODOO_PASSWORD'),
      }),
    });

    API Reference

    OdooService Methods

    authenticate()

    Authenticates with the Odoo server and returns a user ID.

    search(model: string, domain: any[], options: any = {})

    Searches for records matching the given domain.

    read(model: string, ids: number[], fields: string[] = [])

    Reads the specified fields of records with the given IDs.

    searchRead(model: string, domain: any[] = [], fields: string[] = [], options: any = {})

    Combines search and read operations in a single call.

    create(model: string, values: any)

    Creates a new record with the given values.

    write(model: string, id: number, values: any)

    Updates an existing record with the given values.

    unlink(model: string, id: number)

    Deletes the specified record.

    License

    MIT