OD317 modifier-field-not-in-view¶
A view modifier reads a field the view does not show.
| Category | Severity | Series | Needs the index |
|---|---|---|---|
| Correctness | Error | 17.0 and later, before saas~17.3 | yes |
What it reports¶
A name in an invisible, readonly, required or column_invisible expression that is a field of
its model, in a form, tree or kanban view whose inheritance tree has no <field> or <groupby> of
that name anywhere. A name that is no field at all is OD316's.
Why it matters¶
Before saas~17.3 the client can only evaluate fields the view loads, so Odoo refuses the view when it validates it and the module fails to install. A demo file differs: see load failures. From saas~17.3 Odoo adds the missing field itself.
The rule works per tree rather than per subview, so a field shown at another level counts. Modules
outside depends count too, since they may be installed. A <field> counts only from a file Odoo
loads, as OD310 spells out (17.0 odoo/modules/loading.py:40-49), so a name whose only
<field> sits in an extension in any other file is reported: list that extension under data. It
stays silent in the cases OD316 lists, on id and active_id, active_ids and
active_model, on the other view types, which can take fields from attributes, such as a calendar's
date_start, on a field a calendar subview takes from its own attributes or filters, and when the
tree is not fully indexed, as under a parent found only in such a file.
Example¶
state is a field of sale.order, but no element of the view shows it.
<form>
<field name="state" invisible="1"/>
<field name="note" invisible="state == 'done'"/>
</form>