bemade-addons/odoo_to_odoo_bemade_customer/README.md

192 lines
5.8 KiB
Markdown
Raw Normal View History

# Odoo to Odoo Bemade Customer
## Overview
feat: Complete bidirectional sync system with legacy cleanup BREAKING CHANGE: Legacy API key system (sync.api.key) completely removed Major Features: - Complete bidirectional synchronization system between Odoo instances - Legacy API key system removal and migration to built-in Odoo API keys - Full protocol support: XML-RPC, JSON-RPC, and OdooRPC with API token authentication - Bidirectional project sync with assign/receive wizard system - Auto-sync wizard for intelligent field selection - Comprehensive test suite for sync workflows Detailed Changes: odoo_to_odoo_sync (base module): - Removed legacy sync.api.key and sync.api.key.log models entirely - Added sync_project and sync_project_config_wizard models - Enhanced sync_instance with proper Odoo 18 API key format support - Added protocol selection (XML-RPC, JSON-RPC, OdooRPC) with API token auth - Implemented comprehensive authentication with debug logging - Added test_sync_workflow.py for complete workflow testing - Updated security access rules for new models - Enhanced error handling and state management odoo_to_odoo_bemade (server module): - Created OdooToBemadeInstance model for enhanced instance management - Added assign project wizard for server-side project distribution - Implemented project key and API token generation system - Added automatic sync model creation for projects and tasks - Enhanced sync_instance with bidirectional sync capabilities - Updated views and security access for new functionality - Removed legacy API key references and views odoo_to_odoo_bemade_customer (client module): - Added project model with Bemade sync flags (is_bemade_project, bemade_project_key) - Created receive project wizard for client-side project acquisition - Implemented multi-protocol support (XML-RPC, JSON-RPC, OdooRPC) - Added project sync validation and configuration system - Enhanced security access rules for client operations - Updated views for project management interface Authentication & Protocol Support: - Fixed Odoo 18 API key format: {'scope': 'rpc', 'key': api_token} - Added comprehensive debug logging for authentication flow - Enhanced error handling with detailed state management - Maintained backward compatibility with fallback attempts - Updated all protocol implementations (XML-RPC, JSON-RPC, OdooRPC) Testing & Validation: - Added complete test suite for bidirectional sync workflow - Implemented comprehensive authentication testing - Added protocol-specific test cases - Enhanced error state validation UI/UX Improvements: - Added intuitive wizards for project assign/receive operations - Implemented auto-sync wizard with field selection modes (Full, Required, Balanced) - Enhanced form views with radio button selections - Added descriptive text and user guidance Security: - Updated security access rules for all new models - Enhanced authentication token handling - Added proper model access controls Migration Notes: - Legacy API key system completely removed - no migration path needed - Uses built-in Odoo API key functionality - All existing configurations remain compatible Files Added/Modified: - Multiple new model files for project sync functionality - Wizard implementations for user workflows - Enhanced test coverage - Updated security rules and access controls - New view definitions for UI components
2025-08-17 08:20:24 -04:00
Complete bidirectional synchronization system for Bemade customers to securely sync with Odoo.bemade.org. Features wizards for project assignment/reception, multi-protocol support (XML-RPC, JSON-RPC, OdooRPC), and automated configuration.
## Features
feat: Complete bidirectional sync system with legacy cleanup BREAKING CHANGE: Legacy API key system (sync.api.key) completely removed Major Features: - Complete bidirectional synchronization system between Odoo instances - Legacy API key system removal and migration to built-in Odoo API keys - Full protocol support: XML-RPC, JSON-RPC, and OdooRPC with API token authentication - Bidirectional project sync with assign/receive wizard system - Auto-sync wizard for intelligent field selection - Comprehensive test suite for sync workflows Detailed Changes: odoo_to_odoo_sync (base module): - Removed legacy sync.api.key and sync.api.key.log models entirely - Added sync_project and sync_project_config_wizard models - Enhanced sync_instance with proper Odoo 18 API key format support - Added protocol selection (XML-RPC, JSON-RPC, OdooRPC) with API token auth - Implemented comprehensive authentication with debug logging - Added test_sync_workflow.py for complete workflow testing - Updated security access rules for new models - Enhanced error handling and state management odoo_to_odoo_bemade (server module): - Created OdooToBemadeInstance model for enhanced instance management - Added assign project wizard for server-side project distribution - Implemented project key and API token generation system - Added automatic sync model creation for projects and tasks - Enhanced sync_instance with bidirectional sync capabilities - Updated views and security access for new functionality - Removed legacy API key references and views odoo_to_odoo_bemade_customer (client module): - Added project model with Bemade sync flags (is_bemade_project, bemade_project_key) - Created receive project wizard for client-side project acquisition - Implemented multi-protocol support (XML-RPC, JSON-RPC, OdooRPC) - Added project sync validation and configuration system - Enhanced security access rules for client operations - Updated views for project management interface Authentication & Protocol Support: - Fixed Odoo 18 API key format: {'scope': 'rpc', 'key': api_token} - Added comprehensive debug logging for authentication flow - Enhanced error handling with detailed state management - Maintained backward compatibility with fallback attempts - Updated all protocol implementations (XML-RPC, JSON-RPC, OdooRPC) Testing & Validation: - Added complete test suite for bidirectional sync workflow - Implemented comprehensive authentication testing - Added protocol-specific test cases - Enhanced error state validation UI/UX Improvements: - Added intuitive wizards for project assign/receive operations - Implemented auto-sync wizard with field selection modes (Full, Required, Balanced) - Enhanced form views with radio button selections - Added descriptive text and user guidance Security: - Updated security access rules for all new models - Enhanced authentication token handling - Added proper model access controls Migration Notes: - Legacy API key system completely removed - no migration path needed - Uses built-in Odoo API key functionality - All existing configurations remain compatible Files Added/Modified: - Multiple new model files for project sync functionality - Wizard implementations for user workflows - Enhanced test coverage - Updated security rules and access controls - New view definitions for UI components
2025-08-17 08:20:24 -04:00
### ✅ Bidirectional Sync Wizards
- **Receive Project Wizard**: `odoo.to.bemade.customer.receive.wizard`
- **Assign Project Wizard**: `odoo.to.bemade.assign.project.wizard` (server-side)
- **One-click setup**: Automated configuration with generated keys
- **Protocol selection**: Choose XML-RPC, JSON-RPC, or OdooRPC
### ✅ Multi-Protocol Support
- **XML-RPC**: Traditional XML-RPC with API key authentication
- **JSON-RPC**: JSON-based protocol with Odoo 18 API format
- **OdooRPC**: Native OdooRPC library with encrypted credentials
### ✅ Secure Authentication
- **Encrypted API keys**: AES encryption for secure storage
- **Project keys**: Unique identifiers for each sync project
- **Token generation**: Automatic API token creation and sharing
### ✅ Project Management
- **Project assignment**: Server assigns projects to clients
- **Project reception**: Client receives and configures projects
- **Key management**: Automatic key/token generation and validation
## Installation
### Prerequisites
- Odoo 17+ or 18+
- `odoo_to_odoo_sync` module (base framework)
- Network access to Odoo.bemade.org
### Installation Steps
1. Install base dependencies:
```bash
pip install odoorpc # For OdooRPC protocol
```
2. Install in Odoo:
- Go to Apps → Search "odoo_to_odoo_bemade_customer"
- Click Install
## Configuration
### Server Side (Bemade)
1. Install `odoo_to_odoo_bemade` module
2. Navigate to **Project → Bemade Sync → Assign to Client**
3. Select project and configure sync settings
4. Generate project key and API token
5. Share credentials with customer
### Client Side (Customer)
1. Install `odoo_to_odoo_bemade_customer` module
2. Navigate to **Project → Bemade Sync → Receive from Bemade**
3. Enter provided credentials:
- Bemade server URL (default: https://odoo.bemade.org)
- Database name
- Username
- API Key
- Project Key
4. Select protocol (XML-RPC/JSON-RPC/OdooRPC)
5. Test connection and receive project
## Usage
### Using the Receive Project Wizard
1. **Open Wizard**: Project → Bemade Sync → Receive from Bemade
2. **Enter Connection Details**:
- Server URL: https://odoo.bemade.org (or custom)
- Database: Target database name
- Username: Your Bemade username
- API Key: Generated from user preferences
- Project Key: Provided by Bemade
3. **Select Protocol**: XML-RPC, JSON-RPC, or OdooRPC
4. **Test Connection**: Validate settings before proceeding
5. **Receive Project**: Import project data and tasks
### Protocol Configuration
- **XML-RPC**: Traditional XML-RPC protocol
- **JSON-RPC**: JSON-based with Odoo 18 format: `{'scope': 'rpc', 'key': 'api_key'}`
- **OdooRPC**: Native library with automatic connection handling
### Field Mapping
- **Automatic**: Pre-configured field mappings for common models
- **Manual**: Override mappings via sync model configuration
- **Transformations**: Support for field value transformations
## Bidirectional Sync Workflow
### 1. Server Assignment
```
Bemade Server → Assign Project Wizard → Generate Keys → Share with Client
```
### 2. Client Reception
```
Client → Receive Project Wizard → Enter Credentials → Import Project → Configure Sync
```
### 3. Ongoing Synchronization
- **Automatic**: Real-time sync based on triggers
- **Manual**: Force sync via project actions
- **Scheduled**: Cron-based regular synchronization
## API Authentication Format
### Odoo 18 API Key Format
```python
# XML-RPC
{'scope': 'rpc', 'key': 'your_api_key_here'}
# JSON-RPC
{
"jsonrpc": "2.0",
"method": "call",
"params": {
"service": "common",
"method": "login",
"args": ["database", "username", {"scope": "rpc", "key": "api_key"}]
}
}
# OdooRPC
odoo.login(database, username, api_key)
```
## Troubleshooting
### Common Issues
1. **Connection Failed**: Check URL, credentials, and network access
2. **Authentication Error**: Verify API key format (Odoo 18 requires scope parameter)
3. **Project Not Found**: Ensure project key is correct and project exists
4. **Protocol Error**: Try different protocol (XML-RPC/JSON-RPC/OdooRPC)
### Debug Commands
```python
# Enable debug logging
import logging
logging.getLogger('odoo.sync').setLevel(logging.DEBUG)
# Test connection programmatically
sync_instance = env['odoo.sync.instance'].search([('name', '=', 'bemade')])
sync_instance.test_connection()
```
## Project Configuration
### Project Fields Added
- **is_bemade_project**: Boolean flag for Bemade projects
- **bemade_project_key**: Unique project identifier
- **bemade_sync_enabled**: Enable/disable synchronization
### Security Access
- **User Groups**: Bemade Sync User, Bemade Sync Manager
- **Permissions**: Read, Create, Write, Delete based on role
## Development
### Extending Functionality
- **Custom Wizards**: Inherit from base wizard classes
- **Protocol Handlers**: Add new protocol support
- **Field Transformers**: Custom field value transformations
- **Conflict Resolvers**: Custom conflict resolution strategies
### Testing
```bash
# Run module tests
./odoo-bin -d your_database -u odoo_to_odoo_bemade_customer --test-enable
# Test specific wizard
env['odoo.to.bemade.customer.receive.wizard'].create({...}).action_receive_project()
```
## Support
### Getting Help
- **Logs**: Check Odoo logs and sync logs
- **Connection Test**: Use built-in connection validation
- **Support**: Contact Bemade support with sync logs
### Log Locations
- **Odoo Logs**: `/var/log/odoo/odoo.log`
- **Sync Logs**: Settings → Technical → Odoo Sync → Logs
- **Debug Mode**: Enable debug logging for detailed information
---
*Last Updated: 2025-08-16*
*Compatible with Odoo 17+ and 18+*