mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-21 10:32:09 +02:00
Initial commit: Core packages
This commit is contained in:
commit
12c29a983b
9512 changed files with 8379910 additions and 0 deletions
65
odoo-bringout-oca-ocb-base/doc/ARCHITECTURE.md
Normal file
65
odoo-bringout-oca-ocb-base/doc/ARCHITECTURE.md
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# Architecture
|
||||
|
||||
This package provides the Odoo core runtime and the `base` addon. It sits at the center of every other addon.
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
subgraph CLI
|
||||
OBIN[`odoo-bin`]
|
||||
CLI[CLI Entrypoints]
|
||||
end
|
||||
subgraph Core
|
||||
CONF[Config Loader]
|
||||
SRV[Server Service]
|
||||
REG[Registry]
|
||||
ORM[Models and ORM]
|
||||
MOD[Modules Loader]
|
||||
HTTP[HTTP Layer]
|
||||
QWEB[QWeb Templates]
|
||||
TOOLS[Tools misc ustr date]
|
||||
end
|
||||
subgraph Services
|
||||
PG[(PostgreSQL)]
|
||||
CRON[Cron]
|
||||
BUS[Bus]
|
||||
I18N[I18n]
|
||||
REPORT[Reports]
|
||||
FS[(Filestore)]
|
||||
end
|
||||
subgraph Base Addon
|
||||
IRM[ir.model and ir.model.fields]
|
||||
IRUI[ir.ui.menu and ir.actions]
|
||||
IRSEC[ir.model.access ir.rule res.groups]
|
||||
RES[res.users res.partner res.company res.currency]
|
||||
IRATT[ir.attachment]
|
||||
IRCONF[ir.config_parameter]
|
||||
end
|
||||
|
||||
OBIN --> CLI --> CONF --> SRV --> REG
|
||||
SRV --> HTTP -->|routes| BaseControllers
|
||||
SRV --> CRON
|
||||
REG --> ORM --> PG
|
||||
MOD --> REG
|
||||
QWEB --> HTTP
|
||||
ORM --> FS
|
||||
ORM --> REPORT
|
||||
ORM --> TOOLS
|
||||
|
||||
BaseControllers -.import.-> HTTP
|
||||
IRM --> ORM
|
||||
IRUI --> HTTP
|
||||
IRSEC -. enforces .-> ORM
|
||||
RES --> ORM
|
||||
IRATT --> ORM
|
||||
IRCONF --> ORM
|
||||
|
||||
BUS <--> HTTP
|
||||
```
|
||||
|
||||
Key Points
|
||||
- Registry: process-wide metadata for all models, caches, and methods.
|
||||
- ORM: `models.Model`, fields, environment, and caching. All addons extend here.
|
||||
- HTTP: WSGI app; controllers decorated with `@http.route` handle requests.
|
||||
- Modules Loader: resolves addons path, reads manifests, installs/updates.
|
||||
- Base Addon: provides the essential models that enable everything else.
|
||||
- Services: PostgreSQL connections, cron workers, bus long-polling, i18n.
|
||||
45
odoo-bringout-oca-ocb-base/doc/BASE_ADDON.md
Normal file
45
odoo-bringout-oca-ocb-base/doc/BASE_ADDON.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# Base Addon Deep Dive
|
||||
|
||||
The `base` addon provides the foundation for all Odoo applications.
|
||||
|
||||
## Key Models
|
||||
- `ir.model`, `ir.model.fields`: model metadata and fields registry.
|
||||
- `ir.ui.menu`, `ir.actions.*`: client actions and menu hierarchy.
|
||||
- `ir.config_parameter`: runtime configuration key/value store.
|
||||
- `ir.attachment`: binary attachments with filestore storage.
|
||||
- `res.users`, `res.groups`, `res.company`, `res.partner`, `res.currency`.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class ir_model
|
||||
class ir_model_fields
|
||||
class ir_ui_menu
|
||||
class ir_actions
|
||||
class ir_config_parameter
|
||||
class ir_attachment
|
||||
class res_users
|
||||
class res_groups
|
||||
class res_company
|
||||
class res_partner
|
||||
class res_currency
|
||||
|
||||
ir_model <.. ir_model_fields
|
||||
res_users --> res_groups
|
||||
res_users --> res_company
|
||||
res_partner --> res_company
|
||||
ir_ui_menu --> ir_actions
|
||||
ir_attachment --> res_users
|
||||
```
|
||||
|
||||
## Controllers
|
||||
- Minimal endpoints for attachments and common actions.
|
||||
|
||||
## Security
|
||||
- Group definitions and default access rights via `ir.model.access.csv`.
|
||||
- Record rules for multi-company and user-specific data.
|
||||
|
||||
## Data
|
||||
- Seed actions, menus, parameters, currencies, companies, languages.
|
||||
|
||||
## Notes
|
||||
- Many application modules only extend these models via `_inherit`.
|
||||
18
odoo-bringout-oca-ocb-base/doc/CLI.md
Normal file
18
odoo-bringout-oca-ocb-base/doc/CLI.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# CLI
|
||||
|
||||
Entrypoints to manage Odoo from the command line.
|
||||
|
||||
## `odoo-bin`
|
||||
- Start the server: `odoo-bin -c odoo.conf`
|
||||
- Initialize DB: `-d dbname -i base`
|
||||
- Update modules: `-u module1,module2`
|
||||
|
||||
## Common Flags
|
||||
- `--addons-path=/path1,/path2`
|
||||
- `--db_host`, `--db_port`, `--db_user`, `--db_password`
|
||||
- `--http-port=8069`, `--longpolling-port=8072`
|
||||
- `--workers=0` (single process) or `>0` (multi workers)
|
||||
|
||||
## Logs
|
||||
- `--log-level=info` (or debug_sql, debug_rpc)
|
||||
- Logs go to stdout or file via `--logfile`
|
||||
17
odoo-bringout-oca-ocb-base/doc/CONFIG.md
Normal file
17
odoo-bringout-oca-ocb-base/doc/CONFIG.md
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# Configuration
|
||||
|
||||
## Sources
|
||||
- `odoo.conf` INI file (path via `-c` flag or defaults)
|
||||
- CLI flags (e.g., `--db_host`, `--addons-path`)
|
||||
- `ir.config_parameter` (DB-scoped runtime key/values)
|
||||
- Environment variables (rarely used, mainly for testing)
|
||||
|
||||
## Important Options
|
||||
- Database: `db_host`, `db_port`, `db_user`, `db_password`
|
||||
- HTTP: `xmlrpc_port`/`http_port`, `longpolling_port`
|
||||
- Workers: `workers`, `limit_time_cpu`, `limit_memory_hard`
|
||||
- Paths: `addons_path`, `data_dir` (filestore)
|
||||
|
||||
## Addons Path
|
||||
- Multiple paths comma-separated
|
||||
- Python 3.11 namespace path fix applied in this package
|
||||
26
odoo-bringout-oca-ocb-base/doc/DATABASE_INIT.md
Normal file
26
odoo-bringout-oca-ocb-base/doc/DATABASE_INIT.md
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
# Database Initialization & Fixes
|
||||
|
||||
This package includes critical fixes ensuring smooth database initialization on Odoo 16 with Python 3.11+.
|
||||
|
||||
## Module Categories Fix
|
||||
|
||||
Issue: missing module categories referenced by `ir_module_module.xml` during init.
|
||||
|
||||
Fix: add the categories to `base` data (`ir_module_category_data.xml`).
|
||||
|
||||
Impact: DB initializes cleanly; no more `External ID not found` errors.
|
||||
|
||||
## Python 3.11 Addons Path Fix
|
||||
|
||||
Issue: `_NamespacePath` cannot be `+`-concatenated with lists (Python 3.11+), breaking addons path handling.
|
||||
|
||||
Fix: cast namespace path to list before concatenation:
|
||||
|
||||
```python
|
||||
# BEFORE
|
||||
addons_paths = odoo.addons.__path__ + [root_path]
|
||||
# AFTER
|
||||
addons_paths = list(odoo.addons.__path__) + [root_path]
|
||||
```
|
||||
|
||||
Impact: runtime stable on Python 3.11–3.12.
|
||||
53
odoo-bringout-oca-ocb-base/doc/ENTERPRISE_REMOVE.md
Normal file
53
odoo-bringout-oca-ocb-base/doc/ENTERPRISE_REMOVE.md
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
# Remove Enterprise Proprietary Modules from Apps
|
||||
|
||||
This package is customized to remove Odoo Enterprise promotional modules from the Apps list and keep them from coming back on upgrades.
|
||||
|
||||
## Summary of Changes
|
||||
|
||||
- Stop seeding enterprise promo modules: the Base module no longer loads `data/ir_module_module.xml` that created `ir.module.module` rows with `to_buy=True` (promotional stubs pointing to Enterprise apps).
|
||||
- Post-init cleanup: upon upgrading `base`, we purge any existing promotional entries with `to_buy=True` and a proprietary license.
|
||||
- UI filter: the Apps action (`open_module_tree`) now has a domain `[("to_buy", "=", False)]` so any residual `to_buy=True` entries are hidden in the Apps list.
|
||||
|
||||
## Files Touched
|
||||
|
||||
- `odoo/addons/base/__manifest__.py`
|
||||
- Commented out the line that loaded `data/ir_module_module.xml`.
|
||||
- `odoo/addons/base/__init__.py`
|
||||
- Extended `post_init` to delete `ir.module.module` records matching:
|
||||
- `to_buy = True`
|
||||
- `license in ['OEEL-1', 'OEEL', 'OPL-1', 'Proprietary']`
|
||||
- `odoo/addons/base/views/ir_module_views.xml`
|
||||
- Added a domain on the `open_module_tree` action: `[("to_buy", "=", False)]`.
|
||||
|
||||
## Why
|
||||
|
||||
In vanilla Odoo, `base/data/ir_module_module.xml` seeds several records flagged with `to_buy=True` (e.g., Studio, Knowledge, Helpdesk, etc.), which show up in the Apps screen with an Upgrade/Install button but link to Enterprise features. This customization removes those marketing entries to keep the Apps list clean and avoid confusion.
|
||||
|
||||
## How to Apply
|
||||
|
||||
1. Upgrade the `base` module so the manifest change and post-init hook run:
|
||||
- UI: Apps → search `Base` → `Upgrade`.
|
||||
- CLI: `odoo -u base -d <your_db>` (or via your wrapper script).
|
||||
2. Refresh the Apps page. The Enterprise proprietary entries should be gone.
|
||||
|
||||
## Notes and Caveats
|
||||
|
||||
- App list updates: If you use "Update Apps List" pulling from Odoo Apps server, external data could re-introduce promotional entries. With this change, any `to_buy=True` entries matching proprietary licenses are cleaned up again on the next `base` upgrade, and the Apps action already hides `to_buy=True` entries by domain.
|
||||
- Safety: The cleanup runs best-effort inside a `try/except` to avoid breaking the base post-init. It only targets obvious proprietary licenses.
|
||||
|
||||
## Rollback
|
||||
|
||||
To restore the default behavior:
|
||||
|
||||
1. Re-enable loading of `data/ir_module_module.xml` in `odoo/addons/base/__manifest__.py`.
|
||||
2. Remove the promo cleanup block from `odoo/addons/base/__init__.py` `post_init`.
|
||||
3. Upgrade `base` again: `odoo -u base -d <your_db>`.
|
||||
|
||||
## Related Paths
|
||||
|
||||
- Removed data file (not loaded anymore): `odoo/addons/base/data/ir_module_module.xml`
|
||||
- Model implementing Apps logic: `odoo/addons/base/models/ir_module.py`
|
||||
|
||||
## Screenshot Reference
|
||||
|
||||
- Original issue context: `input/screenshot-2025-08-23_17-38-34.png`
|
||||
10
odoo-bringout-oca-ocb-base/doc/FAQ.md
Normal file
10
odoo-bringout-oca-ocb-base/doc/FAQ.md
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# FAQ
|
||||
|
||||
- Q: Which Odoo is this?
|
||||
- A: OCA/OCB 16.0 core runtime + base addon, Python 3.11–3.12 compatible.
|
||||
- Q: Can I run only this package?
|
||||
- A: Yes, it boots Odoo and base. You’ll add feature addons via packages/.
|
||||
- Q: Where are web assets handled?
|
||||
- A: Through `web` addon (separate package) and QWeb within HTTP layer.
|
||||
- Q: Where are my configs stored?
|
||||
- A: Combination of `odoo.conf` and `ir.config_parameter` in DB.
|
||||
32
odoo-bringout-oca-ocb-base/doc/HTTP.md
Normal file
32
odoo-bringout-oca-ocb-base/doc/HTTP.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# HTTP Layer
|
||||
|
||||
Request handling and routing.
|
||||
|
||||
## Controllers
|
||||
- Defined with `@http.route` in Python files.
|
||||
- Support auth: `public`, `user`, `none`.
|
||||
- Return types: HTML (QWeb), JSON, files.
|
||||
|
||||
## Request Lifecycle
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant C as Client
|
||||
participant W as WSGI
|
||||
participant R as Router
|
||||
participant CTR as Controller
|
||||
participant T as QWeb
|
||||
|
||||
C->>W: HTTP Request
|
||||
W->>R: match route
|
||||
R->>CTR: call method
|
||||
CTR->>T: render template (optional)
|
||||
T-->>C: HTML/JSON/Stream
|
||||
```
|
||||
|
||||
## Sessions & Security
|
||||
- CSRF tokens for forms.
|
||||
- `request.env` and `request.uid` for user context.
|
||||
- Access rules enforced by ORM.
|
||||
|
||||
## Base Addon
|
||||
- Provides base controllers for menus, actions, attachments APIs.
|
||||
29
odoo-bringout-oca-ocb-base/doc/MODULES.md
Normal file
29
odoo-bringout-oca-ocb-base/doc/MODULES.md
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
# Modules System
|
||||
|
||||
How addons are discovered, installed, and loaded.
|
||||
|
||||
## Addons Path Resolution
|
||||
- `odoo.addons.__path__` and configured `addons_path` entries.
|
||||
- Python 3.11 fix applied: cast namespace path to `list()` before concatenation.
|
||||
|
||||
## Manifests
|
||||
- `__manifest__.py`: dependencies, data files, security, assets.
|
||||
- Dependency graph used to order installation/updates.
|
||||
|
||||
## Loading Process
|
||||
```mermaid
|
||||
flowchart LR
|
||||
A[addons_path] --> F[Find modules]
|
||||
F --> M[Read manifests]
|
||||
M --> G[Build graph]
|
||||
G --> I[Install/Upgrade]
|
||||
I --> REG[Registry]
|
||||
```
|
||||
|
||||
## Data Files
|
||||
- XML/YAML/CSV loaded in manifest order.
|
||||
- `noupdate="1"` for persistent records.
|
||||
|
||||
## Base Addon
|
||||
- Seed system models/actions/menus.
|
||||
- Provides categories, groups, security, and core views.
|
||||
38
odoo-bringout-oca-ocb-base/doc/ORM.md
Normal file
38
odoo-bringout-oca-ocb-base/doc/ORM.md
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
# ORM
|
||||
|
||||
Core concepts that power Odoo’s data layer.
|
||||
|
||||
## Models and Registry
|
||||
- `models.Model`: base class for all business models.
|
||||
- Registry: per-database object storing model classes, metadata, caches.
|
||||
- Environment: `(cr, uid, context)` wrapped as `env`, provides cursors and context.
|
||||
|
||||
## Fields
|
||||
- Basic: `Char`, `Text`, `Boolean`, `Integer`, `Float`, `Date`, `Datetime`.
|
||||
- Monetary & Currency: `Monetary` with `currency_field`.
|
||||
- Relational: `Many2one`, `One2many`, `Many2many`.
|
||||
- Computed, inverse, depends; stored vs. non-stored.
|
||||
|
||||
## APIs
|
||||
- New API (`@api.model`, `@api.depends`, `@api.constrains`, `@api.onchange`).
|
||||
- Environment access: `self.env.cr`, `self.env.user`, `self.env.ref()`.
|
||||
- Access rights: `check_access_rights`, `sudo()`, record rules.
|
||||
|
||||
## Cache & Prefetch
|
||||
- Prefetch groups reads to reduce queries.
|
||||
- Cache invalidates on write/create/unlink.
|
||||
|
||||
## Base Addon Foundation
|
||||
- `ir.model`, `ir.model.fields`: model metadata registry.
|
||||
- `res.users`, `res.partner`, `res.company`: identity and company models.
|
||||
- `ir.attachment`: binary storage via filestore.
|
||||
- `ir.config_parameter`: runtime config key/value store.
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
REG[Registry] --> ENV[Environment]
|
||||
ENV --> ORM[models.Model]
|
||||
ORM --> SQL[SQL (psycopg2)]
|
||||
ORM --> CACHE[Cache/Prefetch]
|
||||
ORM --> SEC[Access + Rules]
|
||||
```
|
||||
7
odoo-bringout-oca-ocb-base/doc/OVERVIEW.md
Normal file
7
odoo-bringout-oca-ocb-base/doc/OVERVIEW.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Overview
|
||||
|
||||
Core Odoo runtime and the `base` addon packaged for Python workflows.
|
||||
|
||||
- Provides the ORM, HTTP server, module loader, tools, and services.
|
||||
- Includes the `base` addon that seeds essential models and security.
|
||||
- Ships `odoo-bin` CLI entrypoints.
|
||||
21
odoo-bringout-oca-ocb-base/doc/SECURITY.md
Normal file
21
odoo-bringout-oca-ocb-base/doc/SECURITY.md
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Security Model
|
||||
|
||||
## Access Rights
|
||||
- `ir.model.access`: per-model CRUD access per group.
|
||||
- Default entries for base models, extended by modules.
|
||||
|
||||
## Record Rules
|
||||
- Domain-based filtering of accessible records.
|
||||
- Multi-company isolation rules in base.
|
||||
|
||||
## Groups
|
||||
- `res.groups` organized by application category.
|
||||
- Inheritance via `implied_ids`.
|
||||
|
||||
## Sudo & Superuser
|
||||
- `sudo()` to bypass rules for system operations.
|
||||
- User ID `1` is superuser.
|
||||
|
||||
## Portal / Public
|
||||
- `public` user for anonymous access.
|
||||
- `portal` group for shared documents and portal pages.
|
||||
46
odoo-bringout-oca-ocb-base/doc/STARTUP.md
Normal file
46
odoo-bringout-oca-ocb-base/doc/STARTUP.md
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
# Startup Flow
|
||||
|
||||
```mermaid
|
||||
sequenceDiagram
|
||||
participant U as User
|
||||
participant OBIN as odoo-bin
|
||||
participant CLI as odoo.cli
|
||||
participant SRV as odoo.service.server
|
||||
participant MOD as odoo.modules
|
||||
participant REG as Registry
|
||||
participant HTTP as HTTP Server
|
||||
participant PG as Postgres
|
||||
|
||||
U->>OBIN: invoke with args
|
||||
OBIN->>CLI: parse config/args
|
||||
CLI->>SRV: start() with conf
|
||||
SRV->>PG: connect(db)
|
||||
SRV->>MOD: load_modules(graph)
|
||||
MOD->>REG: build registry (models, fields)
|
||||
REG-->>MOD: ready
|
||||
SRV->>HTTP: start WSGI workers
|
||||
HTTP-->>U: listen on :8069
|
||||
```
|
||||
|
||||
Phases
|
||||
- Configuration: `odoo.conf`, CLI flags, env vars.
|
||||
- Database: check, create (if init), connect.
|
||||
- Modules graph: resolve dependencies, install/upgrade as needed.
|
||||
- Registry build: import Python files, register models, fields, methods.
|
||||
- HTTP server: start in single-process or multi-worker mode.
|
||||
- Services: cron, longpolling bus, reports, i18n.
|
||||
|
||||
Workers Modes
|
||||
- Single worker (dev): everything in one process (default here).
|
||||
- Multi worker: master + workers via `--workers N`.
|
||||
|
||||
```mermaid
|
||||
flowchart LR
|
||||
CONF[odoo.conf] --> CLI[CLI Parser]
|
||||
CLI --> SVC[Service]
|
||||
SVC --> DB[(PostgreSQL)]
|
||||
SVC --> MOD[Module Loader]
|
||||
MOD --> REG[Registry]
|
||||
REG --> ORM[ORM]
|
||||
SVC --> HTTP[HTTP/WSGI]
|
||||
```
|
||||
16
odoo-bringout-oca-ocb-base/doc/TROUBLESHOOTING.md
Normal file
16
odoo-bringout-oca-ocb-base/doc/TROUBLESHOOTING.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Troubleshooting
|
||||
|
||||
## Addons Path Issues
|
||||
- Ensure `addons_path` includes both this package and your custom addons.
|
||||
- On Python 3.11+, verify the namespace path fix is applied (included here).
|
||||
|
||||
## Database Init Errors
|
||||
- Missing categories: fixed by this package; if seen, re-install base.
|
||||
- `relation "ir_module_module" does not exist`: ensure DB user has privileges; retry init.
|
||||
|
||||
## Web Startup
|
||||
- Port 8069 conflicts: change with `--http-port`.
|
||||
- `public`/`portal` access issues: check group and record rules in base.
|
||||
|
||||
## Filestore Permissions
|
||||
- Ensure `data_dir` is writable by the Odoo process.
|
||||
Loading…
Add table
Add a link
Reference in a new issue