Skip to content

[19.0][FIX] agreement_rebate: always return a Domain from _target_line_domain - #125

Open
gdgellatly wants to merge 1 commit into
OCA:19.0from
gdgellatly:19.0-fix-agreement_rebate-target-line-domain
Open

[19.0][FIX] agreement_rebate: always return a Domain from _target_line_domain#125
gdgellatly wants to merge 1 commit into
OCA:19.0from
gdgellatly:19.0-fix-agreement_rebate-target-line-domain

Conversation

@gdgellatly

Copy link
Copy Markdown

Description

In 19.0, AgreementSettlementCreateWiz._target_line_domain returns
inconsistent types depending on the agreement:

  • a plain list in the common case, but
  • a Domain object when the agreement has rebate_line_ids (via
    Domain(domain) & line_domains).

Any caller — or module overriding this method — that treats the result
as a list then breaks against a Domain. In a downstream module this
surfaced as:

AttributeError: 'DomainAnd' object has no attribute 'append'

What this PR does

Composes the domain natively using Domain and the & operator so the
method always returns a Domain, which is the 19.0 idiom.

Backward compatibility

Behaviour is unchanged:

  • The extra leaves (invoice_date bounds, per-line/rebate_line_ids
    domains) are still AND-ed together, matching the previous implicit
    top-level AND of list concatenation.
  • Internal consumers already accept a Domain: _read_group takes a
    Domain, and the target_domain Char field round-trips it through
    its list-style repr (already the case today for the rebate_line_ids
    branch).
  • Domain remains iterable to the old-style list, so any external code
    still doing list(...) keeps working.

Made with Cursor

In 19.0 `_target_line_domain` returned a mix of types: a plain list in
the common case, but a `Domain` object when the agreement had
`rebate_line_ids`. Callers (and modules overriding this method) that
treat the result as a list then break, e.g. `AttributeError: 'DomainAnd'
object has no attribute 'append'`.

Compose the domain natively with `Domain` and the `&` operator so the
method consistently returns a `Domain`. Behaviour is unchanged: the
extra leaves are still AND-ed together, and the `Domain` round-trips
through the `target_domain` Char field via its list-style repr.

Co-authored-by: Cursor <cursoragent@cursor.com>
@max3903 max3903 added this to the 19.0 milestone Jul 29, 2026
@max3903 max3903 self-assigned this Jul 29, 2026
@max3903

max3903 commented Jul 29, 2026

Copy link
Copy Markdown
Member

Hi @gdgellatly

I believe we are supposed to remove Cursor from the co-author in the commit based on the new OCA AI policy.

@gdgellatly

Copy link
Copy Markdown
Author

@max3903 i believe the policy said the exact opposite. hence I added bit back in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants