addons-cm/project_task_analytic_account_sync
2026-06-16 10:56:18 +02:00
..
models add project_task_analytic_account_sync 2026-06-16 10:56:18 +02:00
tests add project_task_analytic_account_sync 2026-06-16 10:56:18 +02:00
views add project_task_analytic_account_sync 2026-06-16 10:56:18 +02:00
__init__.py add project_task_analytic_account_sync 2026-06-16 10:56:18 +02:00
__manifest__.py add project_task_analytic_account_sync 2026-06-16 10:56:18 +02:00
README.md add project_task_analytic_account_sync 2026-06-16 10:56:18 +02:00

Project Task Analytic Account Sync

This module forces the analytic account of every project task to always be the same as the one defined on its project. It removes the possibility of manual divergences introduced by the is_analytic_account_id_changed flag in Odoo core.

Behavior

  • Task creation: When a task is created and assigned to a project, its analytic_account_id is set to the project's analytic account.
  • Project change: When a task is moved to another project, its analytic account is updated to the new project's account.
  • Project analytic account change: When a project's analytic account is modified, the change is propagated to all existing tasks (active and archived).
  • Manual override ignored: Writing a different analytic account directly on a task is immediately reverted.
  • Analytic account auto-creation: When Odoo auto-creates a project analytic account, the existing tasks are synchronized.

Usage

No user action is required. The synchronization is transparent and enforced server-side.

Technical notes

  • The analytic_account_id field on project.task is kept as a computed stored field but the compute is overridden to always ignore is_analytic_account_id_changed.
  • project.project.write detects changes in analytic_account_id and propagates them in batch.
  • project.task.write detects changes in project_id or analytic_account_id and corrects the value immediately.
  • The task form view makes the analytic account field readonly to avoid confusion.