@classmethod
def _set_warehouse_parent(cls, locations):
    """
        Set the parent of child location of warehouse if not set
        """
    to_update = set()
    to_save = []
    for location in locations:
        if location.type == 'warehouse':
            if not location.input_location.parent:
                to_update.add(location.input_location)
            if not location.output_location.parent:
                to_update.add(location.output_location)
            if not location.storage_location.parent:
                to_update.add(location.storage_location)
            if to_update:
                for child_location in to_update:
                    child_location.parent = location
                    to_save.append(child_location)
                to_update.clear()
    cls.save(to_save)
