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>
24 lines
939 B
Markdown
24 lines
939 B
Markdown
---
|
|
name: odoo-javascript
|
|
description: JavaScript/Odoo frontend conventions for this repo (modules, tours, events, lazy loading). Use when editing JS in static/src/js/ of Odoo addons.
|
|
metadata:
|
|
type: reference
|
|
---
|
|
|
|
# JavaScript (Odoo Web/Frontend)
|
|
|
|
## Style and conventions
|
|
- ES6+ (`let`/`const`, arrow functions). Linting with ESLint (`.eslintrc.js` at root).
|
|
- Odoo pattern: AMD modules (`odoo.define`).
|
|
- **No business logic in JS, only UI and events.** Business logic lives in Python.
|
|
- Comments to explain hacks or workarounds.
|
|
|
|
## Key patterns
|
|
- Scripts in `static/src/js/`.
|
|
- UI tours registered with `web_tour.tour` (test: true, url, steps).
|
|
- **Delegated** events for dynamic elements (lazy loading, infinite scroll in `website_sale_aplicoop`).
|
|
- AJAX via Odoo helpers (`ajax.jsonRpc`).
|
|
|
|
## Common mistakes
|
|
- Business logic in JS → move it to Python.
|
|
- Listeners lost after DOM manipulation → reattach via event delegation.
|