Deprecated attrs View Attribute
A finding from the Migration Audit that flags attrs attribute usage on XML view field tags, which Odoo deprecated starting in version 16.
What This Finding Means
The Migration Audit detected the attrs attribute on an XML view field tag. In Odoo 16 and later, attrs is deprecated and the conditional logic it carries should move to Python-side field modifiers.
Why It Matters
Modules that still rely on attrs generate deprecation warnings in Odoo 16 and may fail to install in Odoo 17 and later, where the parser no longer accepts the legacy syntax.
Old Odoo Example
<field name="user_id" attrs="{'readonly': [('state', '=', 'done')]}"/>Target Version Risk
- Odoo 16 — deprecation warning at view load time
- Odoo 17 and later — potential break, view may fail to parse
Recommended Fix Direction
Move the conditional logic off the view. You can compute the state in the model with fields_view_get, or expose a computed boolean field such as user_id_readonly = fields.Boolean(compute='_compute_user_id_readonly') and reference it directly with the new readonly, invisible, and required attributes that accept Python expressions on the field tag.
How to Verify Manually
Open the form view in the target Odoo version and walk through every workflow state. Confirm that the field's readonly, invisible, and required behavior matches what the original attrs expression produced.
Related Odoo Doctor Tool
The Migration Audit scans your views for deprecated attributes and reports each occurrence so you can review them before upgrading.
Run Migration Audit