如何在DigitalOcean上上传并安装Odoo自定义模块?
Hey there! I’ve gone through this process dozens of times for Odoo instances on DigitalOcean, so let’s break down exactly how to get your custom module up and running:
1. Prep Your Custom Module First
Before uploading, double-check your module has the required structure—Odoo won’t recognize it without these core files:
__init__.py: Empty file, or one that imports your module’s components (models, controllers, etc.)__manifest__.py: Critical metadata file that includesname,version,depends(list of required Odoo modules),author, anddata(paths to views, reports, etc.)- Optional folders:
models,views,controllers,static(for assets like CSS/JS) based on your module’s functionality
Make sure the depends list in __manifest__.py includes all modules your custom code relies on—this prevents installation errors later.
2. Upload the Module to Your DigitalOcean Instance
You’ve got two solid options here:
Command Line (SCP)
Use scp to transfer the module folder from your local machine to your droplet. Replace the paths and IP with your own:
scp -r /local/path/to/your-custom-module root@your-droplet-ip:/opt/odoo/custom-addons/
Note: /opt/odoo/custom-addons is a common custom modules directory—if your Odoo setup uses a different path (like /odoo/addons/custom), adjust accordingly.
GUI Tool (SFTP)
If you prefer a visual interface, use tools like FileZilla:
- Connect to your droplet using your SSH credentials
- Navigate to your Odoo custom addons directory
- Drag-and-drop your module folder from your local machine to the server
3. Fix File Permissions (Critical Step!)
Odoo runs under a dedicated odoo user by default, so you need to make sure this user has access to your module:
# Set ownership to the odoo user/group sudo chown -R odoo:odoo /opt/odoo/custom-addons/your-custom-module/ # Set proper read/write/execute permissions sudo chmod -R 755 /opt/odoo/custom-addons/your-custom-module/
Skipping this step will cause Odoo to fail detecting your module.
4. Let Odoo Recognize the New Module
You need to refresh Odoo’s app list to see your custom module. Pick one of these methods:
Via Odoo Web Interface
- Enable Developer Mode: Go to Settings → Developer Tools → Activate Developer Mode
- Navigate to Apps → click the Update Apps List button (top-right corner)
- Confirm the refresh when prompted
Via Command Line
Run this command to update the module registry (replace paths with your Odoo setup’s):
sudo -u odoo /usr/bin/odoo-bin -c /etc/odoo/odoo.conf -u base --stop-after-init
This tells Odoo to update the module list and shut down—you can restart your Odoo service afterward if needed.
5. Install Your Custom Module
Via Web Interface
- Go back to the Apps menu
- Use the search bar to find your module (search for the
namefrom your__manifest__.py) - Click the Install button and wait for the process to finish
Via Command Line
Use this command to install the module directly (replace your_module_tech_name with your module’s folder/technical name):
sudo -u odoo /usr/bin/odoo-bin -c /etc/odoo/odoo.conf -i your_module_tech_name --stop-after-init
6. Verify the Installation
- Check the Installed Apps list to confirm your module is listed
- Test your module’s functionality (e.g., if it adds a new menu item, check if it appears; if it modifies a form, verify the changes)
Quick Troubleshooting Tips
- If installation fails, check Odoo’s log file for details:
tail -f /var/log/odoo/odoo-server.log - Ensure all dependencies listed in
__manifest__.pyare already installed on your Odoo instance - For production instances, always test the module on a staging droplet first to avoid disrupting live operations
内容的提问来源于stack exchange,提问作者zin-minhtun

