RPC Call Failures in Odoo
RPC (Remote Procedure Call) errors occur both in the Odoo web client and when external applications call Odoo. Common errors:
RPC_ERROR: Odoo Server Error
Traceback (most recent call last):
...
AccessError: You are not allowed to access 'Sales Order' (sale.order) records.
XMLRPCError: cannot marshal None unless allow_none is enabled
ConnectionRefusedError: [Errno 111] Connection refused
jsonrpc error: {"code": 200, "message": "Odoo Server Error", "data": {...}}Fix 1: RPC_ERROR in the Web Client
When you see RPC_ERROR as a notification in the Odoo web interface:
# Step 1: Open browser developer tools (F12)
# Step 2: Go to Console tab — see the full error
# Step 3: Go to Network tab — find the failed request
# Step 4: Click the request — check Response tab for traceback
# The response body contains the actual Python traceback:
{
"jsonrpc": "2.0",
"error": {
"code": 200,
"message": "Odoo Server Error",
"data": {
"name": "odoo.exceptions.AccessError",
"debug": "Traceback (most recent call last):...",
"message": "You are not allowed to access..."
}
}
}Fix 2: Access Rights Errors via RPC
# Error: AccessError for model 'sale.order'
# Cause: the user making the RPC call lacks permissions
# Check user groups
user = env['res.users'].browse(uid)
print(user.groups_id.mapped('name'))
# Fix: add user to the correct group
# Settings > Users > select user > add to 'Sales / User' group
# For API calls, ensure the user has the right access level
# Or use sudo() in your controller (with proper validation):
@http.route('/api/orders', type='json', auth='public')
def get_orders(self, **kwargs):
# Validate API key first, then sudo
orders = request.env['sale.order'].sudo().search_read(
[('state', '=', 'sale')],
['name', 'partner_id', 'amount_total'],
limit=100
)
return ordersFix 3: XML-RPC Connection Issues
import xmlrpc.client
# Common connection errors:
# ConnectionRefusedError — Odoo is not running or wrong port
# ssl.SSLError — HTTPS required but using HTTP
# TimeoutError — Odoo is overloaded or unreachable
# Correct XML-RPC setup:
url = 'https://odoo.example.com' # Use HTTPS in production
db = 'mydb'
username = 'admin'
password = 'admin_password' # Or API key
# Authenticate
common = xmlrpc.client.ServerProxy(f'{url}/xmlrpc/2/common')
uid = common.authenticate(db, username, password, {})
if not uid:
print("Authentication failed — check credentials")
else:
# Make RPC calls
models = xmlrpc.client.ServerProxy(f'{url}/xmlrpc/2/object')
orders = models.execute_kw(
db, uid, password,
'sale.order', 'search_read',
[[('state', '=', 'sale')]],
{'fields': ['name', 'amount_total'], 'limit': 5}
)Fix 4: JSON-RPC Format Errors
# Wrong: missing JSON-RPC envelope
fetch('/web/dataset/call_kw', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'sale.order',
method: 'search_read',
})
});
// Right: proper JSON-RPC 2.0 format
fetch('/web/dataset/call_kw', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
method: 'call',
params: {
model: 'sale.order',
method: 'search_read',
args: [[['state', '=', 'sale']]],
kwargs: {
fields: ['name', 'amount_total'],
limit: 5,
},
},
})
});Fix 5: Session Expired During RPC
# Error: Session expired or invalid
# Cause: session cookie expired or was invalidated
# For web client: simply refresh the page and log in again
# For API integrations: re-authenticate
# JSON-RPC authentication:
const authResponse = await fetch('/web/session/authenticate', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
jsonrpc: '2.0',
params: {
db: 'mydb',
login: 'admin',
password: 'password',
},
}),
});
// Save the session cookie for subsequent requestsFix 6: RPC Timeout
# Long-running operations may timeout
# Increase limits in odoo.conf:
limit_time_real = 300 # 5 minutes
limit_time_cpu = 150
# For XML-RPC clients:
import xmlrpc.client
transport = xmlrpc.client.SafeTransport()
transport.timeout = 120 # 2 minutes
models = xmlrpc.client.ServerProxy(
f'{url}/xmlrpc/2/object',
transport=transport
)Debugging RPC Calls
# Enable Odoo debug logging for RPC
# In odoo.conf:
log_level = debug_rpc
# This logs all incoming RPC calls with parameters
# Check /var/log/odoo/odoo.log for the full request detailsPrevention
DeployMonkey provides a managed API layer with proper authentication, error handling, and timeout management. The AI agent monitors RPC failures and diagnoses root causes automatically.