Skip to content

Auditlog: related fields not referenced when rule is applied to a model #3491

@VizMan0616

Description

@VizMan0616

Describe the bug

When auditlog applies a rule to a model, if it contains a related field referencing a value from another model or a parent model (Such a lines) if accessed is treat as empty or is not referenced at all resulting in an unexpected behavior even if the parent field or the other model itself containing the value does have it.

I.e: If ModelA have the 'company_id' field and I want to send it to their child `ModelB' through a related field, when accessing to such field on the ir child on a action or a compute is treated as empty.

Following the previous example in the image below, when accessing the 'currency_id.round' of the child model (the parent being withholding_iva_id) which in this case is a related, is comes as empty resulting in an ValueError: Expected singleton: res.currency()

Image Image

To Reproduce

Affected versions: 16.0, 17.0, 18.0

Additional context
One thing I've noticed is from the PR (#3373) and onward is when the rules break such behavior. On the version 17.1.0.5 does not happen at all

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions