`string` for `field` in form

According to the documentation, field can have a string attribute:

The string that is displayed for the widget.

Is this actually meant to be used in form views?

I tried this in a Form view, and the string is not shown.

I searched the source of all modules and the string attribute seems to be used mainly in tree/list views.

On of the occurrences in a form view is in modules/stock/view/configuration_form.xml, and here it has no effect, either, see screenshot

    <label name="shipment_out_return_sequence" string="Customer Return Sequence"/>
    <field name="shipment_out_return_sequence"/>
    <label name="shipment_internal_sequence"/>
    <field name="shipment_internal_sequence" string="Internal Sequence"/>
    <label name="shipment_internal_transit"/>
    <field name="shipment_internal_transit" string="Internal Transit"/>

Further more: It seems as if this is a bug in this very form definition, since for the other fields in this form have the string attribute at the label.

In any view the string attribute of the field is set to the label with the same name as the field.

If you want to use a different string for the label, you can just set the string attribute on the view and this will override the value of the field.

String must be set on the label, not on the field.

In any view the string attribute of the field is set to the label with the same name as the field.

Thx for your quick answer. But what is the string attribute for then? In the official modules it used about 29 times. And it is a valid attribute according the the RNG schema.

The string attribute is used only for labels.
AFAIK its not usable for fields.

If it’s valid on the RNG schema probably we may consider removing it.

On Many2Many fields (which are often put on the view without a label) the string from the field is shown at the top left of the widget.

1 Like

It is also documented.

This is also document and it was not true.
So probably the documentation needs to be updated also.