Skip to content

[IMP] Remove Odoo Agents and add General copilot instructions#36

Open
cav-adhoc wants to merge 1 commit intoingadhoc:mainfrom
adhoc-dev:docker-t-64638-cav
Open

[IMP] Remove Odoo Agents and add General copilot instructions#36
cav-adhoc wants to merge 1 commit intoingadhoc:mainfrom
adhoc-dev:docker-t-64638-cav

Conversation

@cav-adhoc
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings April 16, 2026 14:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- **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.

Copilot uses AI. Check for mistakes.
- **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.
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
- **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.

Copilot uses AI. Check for mistakes.
## 🖼️ XML & View Architecture

- **Clean Inheritance:**
- Use `xpath` with the most specific attributes. Prefer `name` over `expr` or positional indices (`position="after"`).
Copy link

Copilot AI Apr 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
- 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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants