Skip to main content

Module structure

The backend is a single consolidated Odoo 12 addon:

API gateway

All endpoints live under /pos-api/v1/* in controllers/api_v1.py. The gateway handles:
  • JWT Bearer token validation
  • CORS headers
  • Request routing to legacy controller methods
The legacy controller methods in api.py, api_orders.py, etc. have no routes of their own — they are called by api_v1.py.

Extending bootstrap data

To add data to the bootstrap payload, extend the pos.config model:
Do not try to use controller inheritance — it does not work reliably in Odoo 12 for internal methods. Use model inheritance (_inherit) instead.

Upgrading modules

Migrations

Version-specific migration scripts go in migrations/<version>/pre-migrate.py or post-migrate.py. The <version> must match the new version in __manifest__.py.

Declarative configuration

Backend POS configuration (printers, print routes, discount presets, void reasons, special-request tags, side-dish groups, picking-sale reasons, shared configs, and per-terminal nu_* fields) is managed declaratively via the JSON config sync loader. The most recently applied document is replayed automatically on module install and upgrade.

Permissions

The permission system has three layers resolved in order:
  1. Factory defaultspermission_registry.py PERMISSION_DEFAULTS
  2. Per-config role overridesnu.pos.permission.config model
  3. Per-user grant/denynu.pos.permission.user.override model
Permission models should be writable only by base.group_system (admin). Managers should not be able to self-grant privileges.

Adding a new permission

  1. Add the key and default to PERMISSION_DEFAULTS in permission_registry.py
  2. Mirror the same key and default in permissions.ts on the frontend
  3. Both files must stay in sync