manifest / integrations / almoukhlif-odoo-api
WordPress/Odoo Integration
Integrates WooCommerce with Odoo to validate stock before adding products to the cart. Features improved order activity logging with hierarchical file structure for better performance and clean user interface. Includes dedicated debug logging system with admin interface and automatic log rotation by date.
★ 0stars
0forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/makiomar/almoukhlif-odoo-api/archive/refs/heads/master.zipReadme
WordPress/Odoo Integration Plugin
A comprehensive WordPress plugin that integrates WooCommerce with Odoo ERP system for stock validation, order synchronization, and inventory management.
Current Version: 1.263
📋 Changelog
Version 1.263 (Latest)
- 🔧 IMPROVED: Company billing validation now occurs directly before building the
$billing_fieldsarray, ensuring validation happens after all field normalization (postcode, city/state) is complete.
Version 1.262
- 🏢 ADDED: Company orders with invalid company billing fields (per
README-company-validation.md) are no longer sent to Odoo. Instead, the order is marked as failed and a detailed private order note explains which fields are invalid.
Version 1.261
- 🔁 MAINTENANCE: Internal version bump after latest billing and address normalization improvements.
Version 1.260
- 🏢 ENHANCED: Company orders now backfill missing billing details (
company_vat,short_address,address_second,building_number,district) from user meta whenever available.
Version 1.259
- 📨 CHANGED: Postal code padding now uses
1instead of0when WooCommerce provides fewer than 5 digits, avoiding all-zero fallbacks.
Version 1.258
- 📮 NEW: Billing postal codes are sanitized to exactly 5 digits (non-digits removed, padded/truncated as needed) before sending to Odoo.
- 🛡️ ENSURES: Odoo receives consistent postal code format even if WooCommerce data is incomplete.
Version 1.257
- 🧾 ADDED:
billing.is_companyflag is now populated when VAT metadata contains a numeric value (order or customer level). - ✅ ENSURES: Odoo receives explicit company identification with each order payload.
Version 1.256
- 🏙️ IMPROVED: Billing city/state normalization in order payloads—if one is empty, it falls back to the other before sending to Odoo.
- 🔄 UPDATED: Ensures every order sent to Odoo always contains both city and state fields.
Version 1.255
- 🐛 FIXED: Resolved fatal error during checkout caused by malformed callback arrays in WooCommerce hooks.
- 🔧 UPDATED:
woocommerce_checkout_order_createdandwoocommerce_process_shop_order_metahooks now pass priority/args correctly.
Version 1.254
- 📝 ADDED: Manual resend attempts (sync button + bulk actions) now log full request and response payloads inside the activity log for easier auditing.
- 📦 ENHANCED:
send_batch()/send_batch_ajax()support context-aware logging with request snapshots and retry metadata. - 🛠️ UPDATED: Admin bulk resend helpers and sync button now pass context so every manual send attempts is captured with source info.
Version 1.253
- 🐛 FIXED: Order discount calculation now properly captures all discount types (coupons, cart discounts, manual discounts)
- 🔍 ENHANCED: Multi-tier discount retrieval system with fallback methods to ensure discounts are always captured
- 📊 ADDED: Comprehensive debug logging for discount calculation troubleshooting
Version 1.252
- ✅ ADDED: Delivery validation attempts now create activity log entries that include sanitized request metadata and full response details for auditing.
- 🛡️ ENHANCED: Delivery validation helper reuses the exact payload that was logged when calling the API, keeping logs and network traffic perfectly in sync.
Version 1.251
- 🧹 NEW: Admins can clear all activity logs directly from the Activity Logs screen with a confirmation prompt.
- 🧾 ENHANCED: Log clearing summary shows how many files and directories were removed.
Version 1.250
- 🔍 ENHANCED: Activity logs now capture the exact request payload sent to Odoo for success, failure, and cancellation events.
- ⚙️ CHANGED: Order processing passes request payloads through to custom hooks for deeper debugging.
Version 1.249
- 🔧 CHANGED: Removed all
error_log()fallbacks so logs never write to the default WordPress debug log. - ➕ ADDED: New
odoo_logger_missing_handleraction hook for custom fallback logging whenodoo_log()andteamlog()are unavailable.
Version 1.237
- 🛠️ FIXED: Critical WooCommerce Order Status Manager compatibility
- Fixed fatal error caused by array_merge() conflict with WooCommerce Order Status Manager plugin
- Added specific compatibility fix to handle plugin's internal bug
- Adjusted hook priorities to prevent conflicts with other plugins
- Enhanced all hook callbacks with comprehensive input validation
- Ensured all methods return proper data types to prevent null array errors
- Added dedicated compatibility method for WooCommerce Order Status Manager detection and fixes
Version 1.236
- ✨ NEW: Comprehensive Delivery Validation Logging
- Added detailed logging for all data sent to delivery validation endpoint
- Logs include endpoint URL, Odoo order ID, request data, timestamp, user info, IP address, and request source
- Enhanced response logging with response body, status codes, and error details
- Multiple logging methods: teamlog, error_log, and Odoo_Logger class
- Added client IP detection and request source identification (AJAX, CRON, ADMIN, REST_API, FRONTEND)
- Improved debugging and troubleshooting capabilities for delivery validation issues
- ✨ NEW: Enhanced Processed Response Logging with Order IDs
- Added order IDs to all processed response logs for better traceability
- Enhanced logging in Odoo_Response::process_unified() with order IDs, update status, and AJAX context
- Added comprehensive logging for order processing results in both background and AJAX modes
- Enhanced retry attempt logging with order IDs and detailed context
- Improved debugging capabilities for order processing and response handling
- 🔧 ENHANCED: Better error tracking and debugging
- More detailed logging for delivery validation requests and responses
- Enhanced error handling with comprehensive context information
- Better integration with existing logging systems
- Improved order processing result tracking with detailed context
- 🛠️ FIXED: Plugin compatibility improvements
- Added comprehensive input validation to prevent conflicts with other plugins
- Enhanced safety checks in all hook callbacks to ensure proper data types
- Fixed potential array_merge() conflicts with WooCommerce Order Status Manager plugin
- Improved error handling in bulk action registration and order status change hooks
- Added method existence checks to prevent fatal errors with invalid objects
- Added specific compatibility fix for WooCommerce Order Status Manager plugin bug
- Ensured all hook callbacks return proper data types to prevent fatal errors
Version 1.235
- 🔧 ENHANCED: Comprehensive debugging for admin log display
- Added detailed debug information to Order Activity Logs admin page
- Shows log directory status, file information, and raw log contents
- Displays date range, filters applied, and total logs found
- Added file size and line count information for troubleshooting
- Raw log file contents display for administrators to verify data format
Version 1.232
- 🔧 ENHANCED: Comprehensive debugging for order status tracking
- Added detailed debug logging to all order status change hooks
- Added hook registration verification in debug tools
- Enhanced test function to verify log file creation and content
- Added step-by-step debugging to identify why status changes aren't being logged
- Improved troubleshooting capabilities for order tracking issues
Version 1.231
- 🔧 FIXED: PHP Fatal error with debug class accessing private methods
- Made
write_activity_log()method public inOdoo_Order_Activity_Loggerclass - Made helper methods (
get_user_info,detect_trigger_source,get_client_ip,get_user_agent,get_backtrace_info) public - Fixed accessibility issues between debug and logger classes
- Ensured proper method visibility for testing and debugging functionality
- Made
Version 1.230
- 🔧 IMPROVED: Enhanced testing and debugging functionality
- Test functions now automatically create log directory and files if they don't exist
- Added comprehensive logging system setup verification before testing
- Enhanced error handling and feedback for debugging issues
- Added direct logging system test to verify functionality before status tracking tests
- 🛠️ ENHANCED: Better test reliability and user feedback
- Improved error messages with specific troubleshooting information
- Added directory and file creation status feedback
- Better validation of logging system components before running tests
- More detailed debug information for troubleshooting
Version 1.229
- 🔧 FIXED: Complete order status change tracking with WooCommerce data store
- Added
woocommerce_before_shop_order_object_saveandwoocommerce_after_shop_order_object_savehooks - Now properly tracks ALL order status changes including
$order->update_status()calls - Implemented status comparison using before/after save hooks to capture original status
- Enhanced debugging in test function to help troubleshoot tracking issues
- Added
- 🛠️ IMPROVED: Order status change detection
- Added static property to store original order status before save
- Proper cleanup of stored status data after processing
- Better handling of edge cases and invalid order objects
- More robust status comparison logic
Version 1.228
- 🔧 FIXED: Debug page access issue
- Fixed debug menu not appearing in Tools menu due to hook timing
- Added debug page as submenu under "Odoo Orders" for easier access
- Fixed initialization order to ensure debug class loads before menu creation
- Added fallback rendering method in admin class
- 🛠️ IMPROVED: Admin menu organization
- Debug Tools now accessible from both Tools menu and Odoo Orders menu
- Better permission handling for debug functionality
- Improved error handling for missing debug class
Version 1.227
- 🔧 FIXED: Complete order status change tracking
- Added
post_updatedhook to catch ALL order status changes including$order->update_status() - Added REST API hooks to track order status changes via API calls
- Enhanced logging system to capture programmatic status changes
- Added comprehensive testing tools for status change tracking
- Added
- 🛠️ IMPROVED: Order activity logging coverage
- Now tracks status changes from all sources: admin panel, REST API, programmatic calls
- Added detailed logging for REST API order updates with request data
- Enhanced trigger source detection for better audit trails
- ✨ NEW: Update status tracking test functionality
- Added "Test Update Status Tracking" button in debug interface
- Automatically tests
$order->update_status()calls with real orders - Verifies logging system captures all status change methods
- Provides detailed feedback on tracking success/failure
Version 1.226
- 🔧 IMPROVED: Plugin path constants implementation
- Added
ODOO_PLUGIN_FILE,ODOO_PLUGIN_DIR,ODOO_PLUGIN_URL,ODOO_PLUGIN_BASENAMEconstants - Updated all file loading operations to use consistent path constants
- Improved plugin update checker integration with proper file paths
- Enhanced code maintainability and reliability
- Added
- 🛠️ FIXED: Plugin update checker configuration
- Corrected plugin slug from
'wp-odoo-integration/wp-odoo-integration.php'to'wp-odoo-integration' - Fixed initialization timing by moving to
plugins_loadedhook - Added comprehensive debugging and testing tools
- Corrected plugin slug from
- ✨ NEW: Update checker testing functionality
- Added "Test Update Checker" button in debug interface
- Comprehensive diagnostics for GitHub repository access
- Verification of readme.txt presence and releases
Version 1.225
- ✨ NEW: Comprehensive Order Activity Logging System
- Complete audit trail for all order status changes
- User identification and source detection
- Daily log files with detailed context
- Admin interface for viewing and filtering logs
- Debug tools for testing and management
- ✨ NEW: Enhanced Order Status Synchronization
- Now sends both status label and status code to Odoo
wc_order_status: Human-readable status labelwc_order_status_code: Machine-readable status code
- 🔧 IMPROVED: Better error handling and debugging
- 🛠️ FIXED: PHP fatal error with user functions during initialization
- 📊 ENHANCED: Admin interface with activity logs page
- 🔒 SECURITY: Proper permission checks for debug functionality
🚀 Features
- Real-time Stock Validation: Check Odoo stock before adding products to cart
- Order Synchronization: Automatically sync WooCommerce orders to Odoo
- Comprehensive Admin Interface: Monitor failed, sent, and pending orders
- Retry Mechanism: Automatic retry with exponential backoff for failed requests
- Bulk Operations: Send multiple orders to Odoo at once
- Order Status Updates: Sync order status changes between systems
- Stock Updates: Keep WooCommerce stock in sync with Odoo