
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@tapni/odoo-xmlrpc
Advanced tools
A type-safe Odoo XML-RPC client for Node.js written in TypeScript. This package provides a robust interface to interact with Odoo's external API through XML-RPC.
pnpm add @tapni/odoo-xmlrpc
Using npm:
npm install @tapni/odoo-xmlrpc
Using yarn:
yarn add @tapni/odoo-xmlrpc
import { OdooClient } from '@tapni/odoo-xmlrpc';
const { OdooClient } = require('@tapni/odoo-xmlrpc');
import { OdooClient } from '@tapni/odoo-xmlrpc';
// Or for CommonJS:
// const { OdooClient } = require('@tapni/odoo-xmlrpc');
// Define your model interfaces
interface Partner {
id: number;
name: string;
email?: string;
is_company: boolean;
}
async function example() {
// Initialize client, use username/password or apiKey
const client = new OdooClient({
url: 'https://your-odoo-instance.com',
db: 'your-database',
username: 'admin',
password: 'admin',
apiKey: '',
});
try {
// Search and read partners
const partners = await client.searchRead<Partner>('res.partner', [['is_company', '=', true]], {
fields: ['name', 'email'],
limit: 10,
});
console.log('Partners:', partners);
} catch (error) {
if (error instanceof OdooError) {
console.error('Odoo Error:', error.message);
}
}
}
import { OdooClient, OdooBaseModel } from '@tapni/odoo-xmlrpc';
// Extend the base model interface
interface CustomPartner extends OdooBaseModel {
name: string;
email: string;
phone?: string;
is_company: boolean;
child_ids: number[];
}
async function advancedExample() {
// Initialize client, use username/password or apiKey
const client = new OdooClient({
url: 'https://your-odoo-instance.com',
db: 'your-database',
username: 'admin',
password: 'admin',
apiKey: '',
});
// Create a new partner
const partnerId = await client.create<Partial<CustomPartner>>('res.partner', {
name: 'Test Company',
is_company: true,
email: 'test@example.com',
});
// Read the created partner
const [partner] = await client.read<CustomPartner>('res.partner', [partnerId]);
// Update the partner
await client.write<Partial<CustomPartner>>('res.partner', [partnerId], {
phone: '+1234567890',
});
// Delete the partner
await client.unlink('res.partner', [partnerId]);
}
const client = new OdooClient({
url: string; // Odoo instance URL
db: string; // Database name
username: string;
password: string;
apiKey:string;
});
async version(): Promise<OdooVersion>Get Odoo server version information.
async authenticate(): Promise<number>Authenticate with the Odoo server. Called automatically when needed.
async search(model: string, domain: OdooDomain, options?: SearchOptions): Promise<number[]>Search for record IDs.
interface SearchOptions {
offset?: number;
limit?: number;
order?: string;
}
async searchRead<T>(model: string, domain: OdooDomain, options?: SearchReadOptions): Promise<T[]>Search and read records in one call.
interface SearchReadOptions extends SearchOptions {
fields?: string[];
}
async read<T>(model: string, ids: number[], fields?: string[]): Promise<T[]>Read specific records by ID.
async create<T>(model: string, values: T): Promise<number>Create a new record.
async write<T>(model: string, ids: number[], values: T): Promise<boolean>Update existing records.
async unlink(model: string, ids: number[]): Promise<boolean>Delete records.
async fieldsGet(model: string, attributes?: string[]): Promise<OdooFieldsMap>Get field information for a model.
async execute<T>(model: string, method: string, args?: any[], kwargs?: object): Promise<T>Execute any method on an Odoo model. This is useful for calling custom methods or workflow actions.
// Example: Confirm a sale order
await client.execute('sale.order', 'action_confirm', [orderId]);
// Example: Send email using template
await client.execute('mail.template', 'send_mail', [templateId, recordId]);
// Example: Custom method with keyword arguments
await client.execute('your.model', 'your_method', [arg1, arg2], {
kwarg1: 'value1',
kwarg2: 'value2'
});
## Error Handling
The client includes built-in error classes:
- `OdooError`: Base error class for all Odoo-related errors
- `OdooAuthenticationError`: Authentication-specific errors
```typescript
try {
await client.authenticate();
} catch (error) {
if (error instanceof OdooAuthenticationError) {
console.error('Authentication failed:', error.message);
}
}
# Install dependencies
pnpm install
# Build
pnpm run build
# Run tests
pnpm test
# Run tests with coverage
pnpm test:coverage
# Lint
pnpm run lint
# Format code
pnpm run format
# Type check
pnpm run type-check
git checkout -b feature/amazing-feature)git commit -m 'feat: add amazing feature')git push origin feature/amazing-feature)If you're using this client in a browser environment, you might encounter CORS issues. This client is intended for Node.js usage. For browser environments, consider using Odoo's JSON-RPC interface instead.
Make sure your Odoo instance has XML-RPC enabled and your user has the necessary access rights. For Odoo.sh or Odoo Online instances, you might need to whitelist your IP address.
MIT © Dilip Ray Ch
FAQs
Odoo XML-RPC client for Node.js
We found that @tapni/odoo-xmlrpc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.