Base Import Module
Cài đặt module Odoo từ file ZIP cho custom development và deployment
Base Import Module cho phép cài đặt module Odoo trực tiếp từ file ZIP thay vì Odoo App Store, hỗ trợ deploy custom module nội bộ, module từ bên thứ ba, hoặc module đang phát triển.
Module này hữu ích cho việc triển khai module riêng của công ty, test module trước khi publish, hoặc cài đặt module từ GitHub/GitLab mà không cần clone repository.
Tính năng chính
Điểm chính
• Import từ ZIP: Upload file .zip chứa module Odoo và cài đặt trực tiếp
• Dependency Resolution: Tự động kiểm tra và cảnh báo module phụ thuộc thiếu
• Version Check: Kiểm tra tương thích phiên bản Odoo trước khi cài đặt
• Manifest Validation: Xác thực __manifest__.py để đảm bảo cấu trúc đúng
• Multi-module ZIP: Hỗ trợ file ZIP chứa nhiều module cùng lúc
• Update Existing: Cập nhật module đã cài đặt bằng ZIP mới
Thuật ngữ EN/VI
| Fields | Trường dữ liệu | Description |
|---|---|---|
| Module | Module | Gói mở rộng chức năng Odoo |
| Manifest | Manifest | File __manifest__.py chứa metadata module |
| Dependency | Phụ thuộc | Module khác cần thiết để module hoạt động |
| Addons Path | Đường dẫn addons | Thư mục chứa module Odoo |
| Technical Name | Tên kỹ thuật | Tên thư mục module (snake_case) |
Quy trình import module
Các bước thực hiện
1. Chuẩn bị file ZIP: Đảm bảo cấu trúc đúng - thư mục module chứa __manifest__.py, __init__.py, và các file code. Ví dụ: my_module.zip chứa my_module/__manifest__.py.
2. Vào Apps: Mở Apps menu, bật Developer Mode (Settings → Activate Developer Mode), nhấn nút "Import Module" ở góc trên.
3. Upload ZIP: Chọn file ZIP từ máy tính, nhấn Import. Hệ thống sẽ extract và validate manifest.
4. Kiểm tra dependencies: Nếu thiếu module phụ thuộc, cài đặt chúng trước hoặc bỏ qua cảnh báo (không khuyến khích).
5. Install module: Sau khi import thành công, tìm module trong Apps list, nhấn Install.
6. Update Apps List: Nếu không thấy module, nhấn "Update Apps List" để refresh danh sách.
Cấu trúc module chuẩn
File và thư mục bắt buộc
| File/Folder | Bắt buộc | Mô tả |
|---|---|---|
| __manifest__.py | Có | Metadata module: name, version, depends, data |
| __init__.py | Có | Import các submodule Python |
| models/ | Không | Thư mục chứa model (Python class) |
| views/ | Không | Thư mục chứa XML view definition |
| security/ | Không | File ir.model.access.csv, record rules |
| data/ | Không | XML data files (demo, default data) |
| static/ | Không | JS, CSS, images cho frontend |
Ví dụ thực tế
Use cases phổ biến
| Tình huống | Cách thực hiện | Lợi ích |
|---|---|---|
| Deploy custom module nội bộ | Dev team tạo module riêng, đóng gói ZIP, gửi cho admin import vào production. Không cần publish lên Odoo Store. | Bảo mật code nội bộ, kiểm soát phiên bản, deploy nhanh |
| Test module từ GitHub | Download ZIP từ GitHub repository, import vào Odoo test instance. Test trước khi merge vào production. | Test an toàn, không ảnh hưởng production |
| Cài module từ bên thứ ba | Mua module từ vendor, nhận file ZIP, import vào Odoo. Không cần Odoo App Store. | Hỗ trợ module không có trên Store |
| Update module hotfix | Dev sửa bug, tạo ZIP mới, admin import để update module đã cài. Không cần restart server. | Hotfix nhanh, downtime tối thiểu |
Troubleshooting
Điểm chính
• Error "Module not found": Check ZIP structure - module folder must be at ZIP root, not in subfolder
• Error "Invalid manifest": Check __manifest__.py syntax - must be valid Python dict with "name", "version", "depends" keys
• Error "Dependency not met": Install dependencies first, or remove from manifest (riskier)
• Module not in Apps: Click "Update Apps List", clear browser cache, or restart Odoo server
• Permission error: Ensure user has "Administration / Settings" rights to import modules