Hide label in form view when the field is invisible

Current, when we like to hide a field, we do:

def _setup__(cls):
    cls.field_name.states['invisible'] = True

Also we need a extra task: hide the label in XML form view:

    <xpath expr="/form/notebook/page[@id='xxxxx']/label[@name='field_name']" position="replace"></xpath>

IMHO when hide a field, also we need to hide the label.

Could you elaborate why you need to hide a field in a view?
Why you dont replace the field directly with the xpath?

The label inherit the states from its field but only if it does not have already a states defined. This behavior is used for almost all fields that we made invisible.

… because you need replace all views. All tree views, all form views, …

Module “A” add “b” field.
Custom module, hide “b” field because don’t need but need other fields or features defined in module “A”.