Skip to content

Enhancement: Add validation to prevent --groupby and --deferred-fields conflict #186

@bosd

Description

@bosd

Related Issue

This is related to #185 which documents the bug. This issue is for the enhancement to add validation.

Proposal

Add validation logic to detect when the same field appears in both --groupby and --deferred-fields arguments.

Suggested Implementation

In the argument parsing or pre-flight check:

if groupby_field and groupby_field in deferred_fields:
    raise ValueError(
        f"Field '{groupby_field}' cannot be used in both --groupby and --deferred-fields. "
        f"Remove --groupby or remove the field from --deferred-fields."
    )

Alternatives

  1. Auto-fix: Automatically remove the field from groupby when it's deferred (with a warning)
  2. Documentation: At minimum, document this incompatibility

Context

This was discovered during an Odoo 12 → 18 migration where res.partner parent/child relationships were silently broken due to this flag combination in the import script.

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