Port .github Copilot setup to Claude Code: - CLAUDE.md: condensed project instructions (auto-loaded each session) - .claude/skills: per-language guides (odoo-python, odoo-xml-views, odoo-qweb-html, odoo-javascript) + openspec-* workflow skills - .claude/commands/opsx: /opsx:explore|propose|apply|archive slash commands Original .github/ files kept untouched as extended reference. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
70 lines
3.8 KiB
Markdown
70 lines
3.8 KiB
Markdown
# Kidekoop — Odoo 18.0 Custom Addons
|
|
|
|
Odoo 18.0 (OCB community) addons repo. Code in **English**, UI in **Basque/Spanish**.
|
|
Combines OCB (`ocb/`), inherited OCA addons, and our own custom addons.
|
|
|
|
## ⚠️ Critical rules (non-negotiable)
|
|
|
|
- **DO NOT modify** the OCB core (`ocb/`) nor these original OCA addons (reference/inheritance only):
|
|
`product_main_seller`, `product_origin`, `account_invoice_triple_discount`,
|
|
`product_get_price_helper`, `product_price_category`, `purchase_triple_discount`.
|
|
All changes go in our own custom addons.
|
|
- **Do NOT use `_()` in field definitions** (triggers import-time warnings). Only in methods/executable code.
|
|
- **Business logic ALWAYS on `product.product`** (variants), never on `product.template` (use `related` there).
|
|
Avoids issues with pricelists and reports that operate at the variant level.
|
|
- **No logic in QWeb**: prepare all data in the Python controller; templates only do simple attribute access.
|
|
- **No business logic in JavaScript**: UI/events only.
|
|
- Translations: edit `.po` files with `polib` (append). **`msgmerge` corrupts the files** — do not use it.
|
|
|
|
## Stack
|
|
|
|
Odoo 18.0 · Python 3.10+ · PostgreSQL · Docker Compose · XML/QWeb/JS.
|
|
Formatting: `black` (line 88) + `isort` (black profile) + `flake8` + `pylint-odoo`. Pre-commit active.
|
|
|
|
## Commands
|
|
|
|
```bash
|
|
docker-compose up -d # env (8070=web, 8073=longpolling)
|
|
docker-compose run odoo odoo -d odoo --test-enable --stop-after-init -u <addon> # tests (run, NOT exec: avoids cache)
|
|
docker-compose exec odoo odoo -d odoo -u <addon> --stop-after-init # update addon
|
|
docker-compose logs -f odoo # logs
|
|
docker-compose exec db psql -U odoo -d odoo # postgres
|
|
make lint | make format | make check-format | make flake8 | make pylint-required
|
|
pre-commit run --all-files
|
|
```
|
|
|
|
## Odoo conventions
|
|
|
|
- Models `snake.case` · classes `PascalCase` · files `snake_case.py` · XML IDs `module.name`.
|
|
- Manifest always `__manifest__.py`, version `18.0.X.Y.Z`, `depends` alphabetically ordered.
|
|
- Views: 4 spaces, explicit `position` in XPath, groups via `module.xml_id`, `sequence` for ordering.
|
|
- Bulk: prefer `search().write()` over loops; `create([vals, ...])` for bulk create.
|
|
- Notifications: `ir.actions.client` + `display_notification`.
|
|
- Detailed logging in price/discount computations: `_logger.info("[PRICE] ...", ...)`.
|
|
- i18n: each addon ships `i18n/{es,eu}.po` (mandatory) + `.pot`. UTF-8 charset.
|
|
|
|
## Custom addons
|
|
|
|
- `product_sale_price_from_pricelist` — auto-computes sale price from last purchase price + pricelist.
|
|
Requires taxes on the product and `last_purchase_price_compute_type != "manual_update"`.
|
|
- `website_sale_aplicoop` — Eskaera: collaborative purchasing for consumer co-ops (group orders,
|
|
per-member carts, cutoff/pickup dates, lazy loading, multi-language).
|
|
- `account_invoice_triple_discount_readonly` — fix for triple-discount accumulation bug (always use it).
|
|
- `product_price_category_supplier` — price categories per supplier.
|
|
|
|
## Documentation
|
|
|
|
- Per-addon details: its `README.rst` (OCA) or `README_DEV.md` (technical).
|
|
- Global patterns: `.github/copilot-instructions.md` (extended version of this file).
|
|
- Guides: `docs/QWEB_BEST_PRACTICES.md`, `docs/OCA_DOCUMENTATION.md`, `docs/LAZY_LOADING.md`.
|
|
- OCA `readme/` structure (DESCRIPTION, INSTALL, CONFIGURE, USAGE, CONTRIBUTORS, CREDITS).
|
|
Credits: Criptomart (author) + Elika Bilbo (funder).
|
|
|
|
## Commits
|
|
|
|
`[TAG] module: description` — tags: `[ADD] [FIX] [IMP] [REF] [REM] [I18N] [DOC]`.
|
|
|
|
## Available skills
|
|
|
|
Per-language skills (`odoo-python`, `odoo-xml-views`, `odoo-qweb-html`, `odoo-javascript`) and the
|
|
OpenSpec workflow (`openspec-explore/propose/apply-change/archive-change`, `/opsx:*` commands) live in `.claude/`.
|