Python scripting: How to hide from viewport all child objects linked through parent
Boolean with update




A hide_children boolean property is added to all objects.
If the property is updated all children are hidden, plus their hide_children is set, propagating the hide down the hierarchy.


2.8x Test script, with property drawn on text editor footer. 

import bpy
from bpy.props import BoolProperty


def hide_children(self, context):
    self.hide_set(self.hide_children)
    for o in self.children:
        o.hide_children = self.hide_children


bpy.types.Object.hide_children = BoolProperty(update=hide_children)


def draw(self, context):
    layout = self.layout
    ob = context.object
    layout.prop(ob, "hide_children")


bpy.types.TEXT_HT_footer.append(draw)


Similarly to only toggle children

def hide_children(self, context):
    for o in self.children:
        o.hide_set(self.hide_children)
        o.hide_children = self.hide_children


These are object properties, to layout for all objects in scene

for o in scene.objects:
    layout.prop(o, "hide_children")


Note: For 2.8x would be very tempted to do this with collections, and their hierarchy instead of objects.