[IMP] Remove Odoo Agents and add General copilot instructions#36
[IMP] Remove Odoo Agents and add General copilot instructions#36cav-adhoc wants to merge 1 commit intoingadhoc:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR consolidates repository-wide guidance for Copilot into a single .github/copilot-instructions.md file and removes several specialized Odoo agent definitions, aiming to standardize how code suggestions are generated across the repo.
Changes:
- Added global Odoo development guidelines in
.github/copilot-instructions.md. - Removed multiple Odoo-specific agent prompt files under
.github/agents/.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| data/custom/repositories/.github/copilot-instructions.md | Introduces centralized Odoo ORM/view/security/performance guidance for Copilot suggestions. |
| data/custom/repositories/.github/agents/odoo.agent.md | Removes the general Odoo agent definition and skill-mapping instructions. |
| data/custom/repositories/.github/agents/odoo-upgrade-migration.agent.md | Removes the upgrade/migration-specific agent and its repository/process rules. |
| data/custom/repositories/.github/agents/odoo-translator.agent.md | Removes the translation-specific agent guidance for .po/.pot workflows. |
| data/custom/repositories/.github/agents/odoo-test-from-video.agent.md | Removes the agent for generating Odoo tests from video-derived scripts. |
| data/custom/repositories/.github/agents/odoo-test-from-commit.agent.md | Removes the agent for generating Odoo tests from git diffs. |
| data/custom/repositories/.github/agents/odoo-module-generator.agent.md | Removes the agent for scaffolding new Odoo modules (including manifest/license templates). |
| data/custom/repositories/.github/agents/odoo-code-review.agent.md | Removes the static Python-only Odoo code review agent playbook. |
| data/custom/repositories/.github/agents/odoo-auto-readme.agent.md | Removes the agent for generating/syncing module README.rst files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| - Use vectorized operations. Avoid iterating over recordsets (`for record in self`) if a batch operation exists. | ||
| - Use `mapped()`, `filtered()`, and `sorted()` instead of Python loops. | ||
| - **Inheritance & `@api.depends`:** | ||
| - **Cumulative Dependencies:** When overriding a compute method or extending a field, do **NOT** rewrite existing dependencies. Odoo merges them automatically from the parent classes. Only declare the **new** fields your specific logic requires. |
There was a problem hiding this comment.
The guidance about @api.depends being “cumulative” when overriding a compute method is incorrect in Odoo: overriding a compute method replaces the parent method (and its dependencies), so omitting the parent dependencies can lead to fields not recomputing when expected. Update this instruction to require keeping the full dependency set (parent + new) when overriding computes / redefining computed fields.
| - **Cumulative Dependencies:** When overriding a compute method or extending a field, do **NOT** rewrite existing dependencies. Odoo merges them automatically from the parent classes. Only declare the **new** fields your specific logic requires. | |
| - **Full Dependency Set Required:** When overriding a compute method or redefining a computed field, **always** declare the complete dependency list: all parent dependencies **plus** any new fields your logic requires. In Odoo, overriding the compute method replaces the parent method and its dependency declaration; dependencies are **not** merged automatically. |
| - **Inheritance & `@api.depends`:** | ||
| - **Cumulative Dependencies:** When overriding a compute method or extending a field, do **NOT** rewrite existing dependencies. Odoo merges them automatically from the parent classes. Only declare the **new** fields your specific logic requires. | ||
| - **Performance:** | ||
| - **Strictly Avoid N+1 queries.** Never execute `search()`, `browse()`, or `read()` inside a loop. |
There was a problem hiding this comment.
This N+1 rule lumps browse() in with query-producing calls, but browse() itself does not hit the database (it just creates a recordset). Keeping it in the “never in a loop” list may mislead contributors; consider narrowing the instruction to calls that actually execute queries (e.g., search, read, search_read, read_group, mapped on non-prefetched fields).
| - **Strictly Avoid N+1 queries.** Never execute `search()`, `browse()`, or `read()` inside a loop. | |
| - **Strictly Avoid N+1 queries.** Never execute query-producing ORM calls such as `search()`, `read()`, `search_read()`, or `read_group()` inside a loop; also avoid `mapped()` in loops when it would trigger reads on non-prefetched fields. |
| ## 🖼️ XML & View Architecture | ||
|
|
||
| - **Clean Inheritance:** | ||
| - Use `xpath` with the most specific attributes. Prefer `name` over `expr` or positional indices (`position="after"`). |
There was a problem hiding this comment.
In Odoo view inheritance, <xpath> uses the expr attribute; there isn’t a name attribute you can use instead. Reword this to something like “use an expr that targets elements by stable attributes (e.g., @name) and avoid positional selectors” to prevent invalid XML suggestions.
| - Use `xpath` with the most specific attributes. Prefer `name` over `expr` or positional indices (`position="after"`). | |
| - Use `xpath` with an `expr` that targets stable attributes (e.g., `@name`) and avoid positional selectors where possible. |
No description provided.