Skip to content

refactor: replace hardcoded chatter/activity field filters with dynamic Odoo mixin detection #30

@matty-drexler

Description

@matty-drexler

Problem Statement

Currently, inspect_model filters out system-wide chatter and activity fields by checking if the field name starts with hardcoded prefixes:

if (f.name.startsWith('message_') || f.name.startsWith('activity_')) {
  continue;
}

This approach is arbitrary, brittle, and inelegant. It is a 'band-aid' fix that does not scale to other standard Odoo mixins (such as utm.mixin, rating.mixin, website.seo.metadata, or custom business mixins) which inject their own sets of system fields into the model.

Proposed Elegant Solution

Instead of hardcoding field name prefixes, inspect_model should dynamically detect whether fields are inherited from standard Odoo mixins / abstract classes and isolate them into a dedicated metadata bucket (e.g., chatter or mixins).

Implementation Concept:

  1. Query Lineage: Query the parent models of the current target (for example, reading inherits or analyzing the model's defined inheritance array).
  2. Detect Mixin Origins: Match fields whose origin modules or parent definitions stem from abstract system mixins like mail.thread, mail.activity.mixin, utm.mixin, etc.
  3. Clean Categorization: Dynamically filter these fields out of base and extended and group them into their own collapsible mixins block, keeping the core field lists focused strictly on the model's true business data.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions