Test Odoo API connection and sync functionality to diagnose issues.
Tests Odoo API connection, authentication, model access, and sync functionality with comprehensive diagnostics.
/plugin marketplace add jamshu/jamshi-marketplace/plugin install odoo-pwa-generator@jamshi-marketplaceTest Odoo API connection and sync functionality to diagnose issues.
Before testing, ensure:
.env file exists and is configuredVerify all required environment variables are set:
VITE_ODOO_URL - Odoo instance URLVITE_ODOO_DB - Database nameODOO_API_KEY - API authentication keyODOO_USERNAME - User email/usernameVITE_MODEL_NAME - Primary model name# Test if Odoo URL is reachable
curl -I [ODOO_URL]
Expected: HTTP 200 or 301/302 redirect
Make a test API call to verify credentials:
POST /api/odoo
{
"action": "search",
"model": "res.partner",
"domain": [],
"fields": ["id", "name"],
"limit": 1
}
Expected: Returns at least one partner record
Verify the configured model exists and is accessible:
POST /api/odoo
{
"action": "search_model",
"model": "[VITE_MODEL_NAME]",
"domain": [],
"fields": ["id"],
"limit": 1
}
Expected: Returns records or empty array (not an error)
Test each operation:
Verify cache stores work correctly:
Measure sync performance:
.env file🧪 Odoo PWA Connection Diagnostics
================================
✅ Environment Configuration: PASSED
- ODOO_URL: https://yourcompany.odoo.com
- DATABASE: yourcompany-main
- MODEL: x_expense
✅ Network Connectivity: PASSED
- Odoo server reachable
- Response time: 234ms
✅ API Authentication: PASSED
- API key valid
- User authenticated: your.email@company.com
✅ Model Access: PASSED
- Model exists: x_expense
- Read permission: Yes
- Write permission: Yes
✅ CRUD Operations: PASSED
- Create: ✅ Record created (ID: 123)
- Read: ✅ Record fetched
- Update: ✅ Record updated
- Delete: ✅ Record deleted
✅ Cache Functionality: PASSED
- localStorage: Working
- IndexedDB: Working
- Sync interval: 3 minutes
✅ Sync Performance: PASSED
- Initial load: 1.2s (45 records)
- Incremental sync: 0.3s (2 new records)
- Network requests: 3
================================
🎉 All tests passed! Your Odoo PWA is working correctly.
/test-connection - Run full diagnostic suiteError: Cannot reach Odoo URL Solutions:
Error: Invalid API key or credentials Solutions:
.env fileError: Model doesn't exist or no access Solutions:
x_ prefixError: Blocked by CORS policy Solutions:
Error: Records not updating Solutions:
Error: Cannot create/update records Solutions:
Provide user with helpful commands:
# Watch network requests
# Open browser DevTools → Network tab
# View cache contents
localStorage.getItem('[model]Cache')
# Force cache clear
localStorage.clear()
# Monitor sync in console
# Look for "Syncing..." messages
If all tests pass:
If tests fail:
For complex issues: