[ADD] Claude Code ecosystem adapted from Copilot config

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>
This commit is contained in:
GitHub Copilot 2026-06-04 13:29:10 +02:00
parent 8798f321b3
commit 9a7dfe02db
14 changed files with 1443 additions and 0 deletions

View file

@ -0,0 +1,37 @@
---
name: odoo-python
description: Python/Odoo ORM conventions for this repo (models, fields, computed, tests, OCA). Use when writing or modifying Python code in Odoo addons (.py, models/, wizards/, tests/).
metadata:
type: reference
---
# Python (Odoo ORM)
## Style and conventions
- Follow the **OCA guidelines** strictly.
- `black` (line length 88) for formatting, `isort` (black profile) for imports.
- Mandatory linting: `flake8` and `pylint-odoo`.
- Docstrings on classes and public methods; inline comments only for complex logic.
- **Do NOT use `_()` in field definitions** (import-time warning). Only in executable methods.
## Key patterns
- Models inherit from `models.Model` or `models.TransientModel` (wizards).
- **Business fields ALWAYS on `product.product`**, not on `product.template` (use `related` on the template).
Avoids issues with pricelists and reports that operate at the variant level.
- `@api.depends(...)` for computed fields.
- Notifications: `ir.actions.client` with `display_notification` (`type`: success/warning/danger/info).
- Detailed price/discount logging: `_logger.info("[PRICE] Product %s [%s]: ...", code, id, ...)`.
- Bulk updates: prefer `search().write()` over loops; `create([vals, ...])` for bulk create.
- Pricing: use `product_get_price_helper` (`product._get_price(qty=1, pricelist=pricelist)`).
Validate `product.taxes_id` before computing (raise `UserError` if missing).
## Testing
- Tests in each addon's `tests/`, named `test_*.py`, inheriting from `odoo.tests.common.TransactionCase`.
- Run (use `run`, not `exec`, for a clean container):
```bash
docker-compose run odoo odoo -d odoo --test-enable --stop-after-init -u <addon>
```
## Common mistakes
- `_()` in module-level field definitions → warning. Remove it; translation goes through `.po`.
- Computed fields failing in pricelists/reports → move logic to `product.product`.