def valid_field_in_tree(arch):
    """A `tree` must have `string` attribute and an immediate node of `tree` view must be `field` or `button`."""
    if arch.xpath('//tree[not (@string)]'):
        return False
    for child in arch.xpath('/tree/child::*'):
        if child.tag not in ('field', 'button'):
            return False
    return True