### Install mediasoup-client
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/static/lib/odoo_sfu/odoo_sfu.licenses.txt
mediasoup-client is a JavaScript library for the client-side of mediasoup, a WebRTC SFU. This snippet shows how to install it using npm.
```bash
npm install mediasoup-client
```
--------------------------------
### Install ms package
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/static/lib/odoo_sfu/odoo_sfu.licenses.txt
The 'ms' package is a tiny utility for converting milliseconds to strings and vice versa. This command installs it via npm.
```bash
npm install ms
```
--------------------------------
### Install debug utility
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/static/lib/odoo_sfu/odoo_sfu.licenses.txt
The 'debug' package is a lightweight debugging utility for Node.js and the browser. This command installs the package using npm.
```bash
npm install debug
```
--------------------------------
### Install Odoo Push-to-Talk Extension
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/push-to-talk-extension/README.md
Instructions on how to install the Push-to-Talk extension for Odoo 17. This involves loading the unpacked extension folder through the Chrome extensions panel.
```Shell
chrome://extensions/
Load unpacked
push-to-talk-extension
```
--------------------------------
### Install ua-parser-js
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/static/lib/odoo_sfu/odoo_sfu.licenses.txt
ua-parser-js is a library for detecting browser, engine, OS, CPU, and device type/model from User-Agent data. It supports both browser and Node.js environments. This command installs it using npm.
```bash
npm install ua-parser-js
```
--------------------------------
### Mercado Pago Checkout Pro JavaScript SDK Initialization
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/payment_mercado_pago/README.md
This example shows how to initialize the Mercado Pago Checkout Pro's JavaScript SDK on the client-side. It requires a public token and a callback function to handle the payment process.
```JavaScript
const mp = new MercadoPago('YOUR_PUBLIC_KEY', {
locale: 'es-AR'
});
mp.checkout({
preference: {
id: 'YOUR_PREFERENCE_ID'
},
render: {
container: '.mercadopago-checkout',
label: 'Pagar',
}
}).render();
// Optional: Handle payment status updates or redirects
window.addEventListener('mercadopago.payment.success', function (event) {
console.log('Payment successful:', event.detail);
// Redirect or update UI
});
window.addEventListener('mercadopago.payment.error', function (event) {
console.error('Payment error:', event.detail);
// Handle error display
});
```
--------------------------------
### Odoo Website Builder: Inline Editing Example
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/website/README.md
Demonstrates the 'edit inline' approach of the Odoo website builder, allowing users to directly modify content on the page without needing backend access. This feature simplifies website creation for users without technical knowledge.
```HTML
Edit Me Directly
This paragraph can also be edited inline.
```
--------------------------------
### Odoo 17 Block Structure Example
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/website/doc/website.snippet.rst
This HTML structure defines a typical Odoo website block, including a thumbnail for preview and a body for the actual content that will be dropped onto the page. The 'oe_snippet_thumbnail' class is used for the preview, and 'oe_snippet_body' for the content to be inserted.
```html
...Block Name...
```
--------------------------------
### Install python-ldap
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/auth_ldap/README.rst
This module requires the 'python-ldap' package to be installed on the server for LDAP authentication to function correctly.
```Shell
pip install python-ldap
```
--------------------------------
### Configure Keyboard Shortcuts for Push-to-Talk
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/push-to-talk-extension/README.md
Guidance on setting up system-wide keyboard shortcuts for the Push-to-Talk extension. This includes enabling the 'Repeat key' feature and ensuring the command scope is set to 'global'.
```Shell
chrome://extensions/shortcuts
```
--------------------------------
### Asynchronous Task Queue (awaitqueue)
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/static/lib/odoo_sfu/odoo_sfu.licenses.txt
The 'awaitqueue' package is a JavaScript utility designed to enqueue asynchronous tasks and execute them sequentially. It manages the order of operations for asynchronous processes.
```javascript
const AwaitQueue = require('awaitqueue');
const queue = new AwaitQueue();
async function task1() {
console.log('Task 1 started');
await new Promise(resolve => setTimeout(resolve, 1000));
console.log('Task 1 finished');
}
async function task2() {
console.log('Task 2 started');
await new Promise(resolve => setTimeout(resolve, 500));
console.log('Task 2 finished');
}
queue.push(task1);
queue.push(task2);
```
--------------------------------
### Odoo CRM - Lead Automation Example
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/crm/README.md
This snippet demonstrates how Odoo CRM can automate lead acquisition and follow-ups using marketing campaigns. It outlines defining automation rules based on triggers like inactivity or email responses to drive engagement and optimize campaigns from lead to close.
```Odoo CRM
Define automation rules (e.g. ask a salesperson to call, send an email, ...) based on triggers (no activity since 20 days, answered a promotional email, etc.)
```
--------------------------------
### H264 Profile-Level ID Utility (h264-profile-level-id)
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/static/lib/odoo_sfu/odoo_sfu.licenses.txt
A utility for processing H264 profile-level-id values. This package helps in parsing and understanding the parameters associated with H264 video streams.
```javascript
const h264 = require('h264-profile-level-id');
// Example usage (assuming a function to parse)
// const profileInfo = h264.parse('42e01f');
// console.log(profileInfo);
```
--------------------------------
### MIT License
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/mail/static/lib/odoo_sfu/odoo_sfu.licenses.txt
The MIT License is a permissive free software license originating at the Massachusetts Institute of Technology. It is short, simple, and allows users to do whatever they want with the software, including distributing it, modifying it, and using it in proprietary software, provided that the original copyright and license notices are included.
```License
MIT License
Copyright (c) 2012-2023 Faisal Salman <>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
```
--------------------------------
### Stripe Payment Processing with Odoo
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/payment_stripe/README.md
This snippet illustrates the integration of Stripe for payment processing within Odoo. It leverages Stripe.js for frontend payment details and the Stripe API for backend operations like refunds and offline payments. The module follows Stripe's guides for collecting payment details before creating an Intent.
```Python
def _create_stripe_intent(self, transaction):
# Server-to-server API call to Stripe to create an intent
# Requires transaction details and potentially customer information
pass
def _handle_stripe_webhook(self, webhook_data):
# Process incoming webhook notifications from Stripe
# Update transaction status based on event type
pass
```
```JavaScript
stripe = Stripe('YOUR_PUBLISHABLE_KEY');
// Mount Stripe Elements for payment detail input
const elements = stripe.elements();
const cardElement = elements.create('card');
cardElement.mount('#card-element');
// Handle form submission to create payment method or confirm payment
form.addEventListener('submit', async (event) => {
event.preventDefault();
const { paymentMethod, error } = await stripe.createPaymentMethod({
type: 'card',
card: cardElement,
});
// Send paymentMethod.id to backend for further processing
});
```
--------------------------------
### Initiate Payment with Checkout Pro Payload
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/payment_mercado_pago/README.md
This snippet demonstrates how to initiate a payment using the Mercado Pago Checkout Pro's JavaScript SDK payload. It leverages the generic payment redirection flow provided by the 'payment' module in Odoo.
```Python
def _get_checkout_pro_redirect_url(self, order, amount, currency, partner, redirect_url):
# Construct the payment request payload similar to Checkout Pro's JavaScript SDK
payload = {
'transaction_amount': amount,
'currency_id': currency.name,
'payer': {
'email': partner.email,
'first_name': partner.name,
'last_name': partner.last_name,
'identification': {
'type': 'ளுக்கு',
'number': '123456789'
}
},
'back_urls': {
'success': redirect_url + '&state=done',
'failure': redirect_url + '&state=cancel',
'pending': redirect_url + '&state=pending'
},
'notification_url': self.env['ir.config_parameter'].sudo().get_param('web_base_url') + '/payment/mercadopago/webhook',
'auto_return': 'approved'
}
# Make API call to Mercado Pago Checkout Pro to get redirect URL
# ... (API call implementation) ...
return redirect_url
```
--------------------------------
### Load Adyen Web Components SDK Assets
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/payment_adyen/README.md
This snippet demonstrates how the Adyen Web Components SDK's JavaScript and CSS assets are loaded directly from the `__manifest__.py` file in the Odoo module. This is a common pattern for integrating third-party frontend libraries.
```Python
def __manifest__():
"""Manifest configuration for the Odoo module."""
return {
# ... other manifest configurations ...
'assets': {
'web.assets_frontend': [
'your_module/static/src/js/adyen_web_components.js',
'your_module/static/src/css/adyen_web_components.css',
],
},
# ... other manifest configurations ...
}
```
--------------------------------
### Odoo Website Builder: Multi-Language Support
Source: https://github.com/tickernelz/odoo-17/blob/main/addons/website/README.md
Explains the effortless multi-language capabilities of the Odoo website builder. It automatically proposes and propagates translations across pages, simplifying the process of creating multilingual websites.
```Text
Multi-Language Functionality:
- Automatic translation suggestions.
- Propagation of translations across all pages.
- Easy editing and management of translated content.
```