(location, is_deletion=False)
Called on location save() or delete().  Updates the supply_point_id if appropriate
Called on location save() or delete().  Updates the supply_point_id if appropriate
Called on location save () or delete () . Updates the supply_point_id if appropriate
def sync_supply_point(location, is_deletion=False):
    """Called on location save() or delete().  Updates the supply_point_id if appropriate"""
    domain_obj = Domain.get_by_name(location.domain)
    if not domain_obj.commtrack_enabled:
        return None

    if location.location_type.administrative or is_deletion:
        close_supply_point_case(location.domain, location.supply_point_id)
        location.supply_point_id = None
    elif location.is_archived:
        close_supply_point_case(location.domain, location.supply_point_id)
    else:
        updated_supply_point = _reopen_or_create_supply_point(location)
        location.supply_point_id = updated_supply_point.case_id
def sync_supply_point ( location , is_deletion = False ) : domain_obj = Domain . get_by_name ( location . domain ) if not domain_obj . commtrack_enabled : return None if location . location_type . administrative or is_deletion : close_supply_point_case ( location . domain , location . supply_point_id ) location . supply_point_id = None elif location . is_archived : close_supply_point_case ( location . domain , location . supply_point_id ) else : updated_supply_point = _reopen_or_create_supply_point ( location ) location . supply_point_id = updated_supply_point . case_id